The group said in a statement it was carried out by “a heroic soldier”.
At least 600 revellers were celebrating in the early hours of Sunday at Istanbul’s Reina nightclub when the gunman began firing indiscriminately.
The gunman is still believed to be at large and a manhunt is under way. Police say they have made eight arrests so far.
IS has been blamed for recent attacks in Turkey, which is taking military action against the group in neighbouring Syria.
The militant group has already been linked to at least two attacks in Turkey last year.
The IS statement accused Turkey of shedding the blood of Muslims through “its air strikes and mortar attacks” in Syria.
Turkey launched a military operation in August aimed at pushing back IS and Kurdish forces, with some of the most intensive recent fighting against IS around the northern town of al-Bab.
Turkey has also been a key player with Russia in negotiating a truce between moderate rebel forces and the government.
More details of the nightclub attack have been emerging. The gunman, who fired up to 180 bullets, arrived by taxi before rushing through the entrance with a long-barrelled gun he had taken from the boot of the car.Istanbul’s glamorous Reina nightc attacker fired randomly at people in an assault lasting seven minutes, starting with a security guard and a travel agent near the entrance. Both were killed.
The gunman is reported to have removed his overcoat before fleeing during the chaos.
Turkish media reports quote police sources as saying he may have been from Uzbekistan or Kyrgyzstan.
Kyrgyzstan’s foreign ministry said the reports that the suspect might be Kyrgyz were “doubtful” but that it would carry out checks.
Police are investigating whether he belongs to an IS cell blamed for an attack in June on Ataturk Airport in Istanbul.
President Recep Tayyip Erdogan accused groups such as IS of trying “to create chaos”.
“They are trying to… demoralise our people and destabilise our country,” he said.
Turkey suffered a bloody 2016 with a series of attacks, some carried out by Kurdish militants.
But a day before the IS claim, the banned Kurdistan Workers’ Party (PKK) was quick to distance itself from the nightclub attack, saying it would “never target innocent civilians”.
Some two-thirds of those killed were foreign, according to local media, among them citizens from Israel, Russia, France, Tunisia, Lebanon, India, Belgium, Jordan and Saudi Arabia.
Bollywood director and producer Abis Rizvi was one of those who died, Indian media report.
Victims by nationality:
- Turkey: 11
- Saudi Arabia: 7
- Iraq: 3
- Lebanon: 3
- Jordan, India, Morocco: two nationals from each country
- Germany, Syria, Israel, France-Tunisia, Tunisia, Belgium, Kuwait, Canada, Russia: one national from each country
A complete record of those killed has yet to emerge. The body of one of those who died has yet to be identified.
Security guard Fatih Cakmak was one of the first to die.
His brother said he narrowly escaped a double bombing three weeks ago, having been on duty when Kurdish militants launched an attack near a football stadium, killing at least 44 people, mostly police.
At least 69 people are being treated in hospital, officials said, with three in a serious condition.
The nightclub, which sits on the banks of the Bosphorus, is one of Istanbul’s most fashionable venues – popular with foreigners and often frequented by singers and sports stars.
Some guests are reported to have thrown themselves into the water to escape the gunman.
Deadly attacks in Turkey in 2016
Istanbul was already on high alert with some 17,000 police officers on duty in the city, following a string of terror attacks in recent months.
10 December: Twin bomb attack outside a football stadium in Istanbul kills 44 people, Kurdish militant group claims responsibility
20 August: Bomb attack on wedding party in Gaziantep kills at least 30 people, IS suspected
30 July: 35 Kurdish fighters try to storm a military base and are killed by the Turkish army
28 June: A gun and bomb attack on Ataturk airport in Istanbul kills 41 people, in an attack blamed on IS militants
13 March: 37 people are killed by Kurdish militants in a suicide car bombing in Ankara
17 February: 28 people die in an attack on a military convoy in Ankara
.BBC