Three attackers arrived in a taxi and began firing at the terminal entrance late on Tuesday. They blew themselves up after police fired back.
PM Binali Yildirim said early signs pointed to so-called Islamic State but no-one has so far admitted the attack.
Recent bombings have been linked to either IS or Kurdish separatists.
Follow the latest updates here
How dangerous is Turkey’s unrest?
Turkey caught in overlapping security crises
Tourism hits ‘rock bottom’
Turkey v IS v Syrian Kurds
Tuesday’s attack looked like a major co-ordinated assault, says the BBC’s Mark Lowen.
Ataturk airport has long been seen as a vulnerable target, our Turkey correspondent adds, reporting from a plane stuck on the tarmac in Istanbul.
There are X-ray scanners at the entrance to the terminal but security checks for cars are limited.
Pictures from the airport terminal showed bodies covered in sheets, with glass and abandoned luggage littering the building.
Turkish President Recep Tayyip Erdogan said the attack should serve as a turning point in the global fight against militant groups.
“The bombs that exploded in Istanbul today could have gone off at any airport in any city around the world,” he said.
The US called the attack “heinous”, saying America remained “steadfast in our support for Turkey”.
German Interior Minister Thomas de Maiziere called the attacks “cowardly and brutal”.
‘Dressed in black’
Istanbul’s governor confirmed 41 people had died and 239 were injured in the attack. At least 13 of those killed were of foreign or dual nationality. Some 109 of those hurt have now been discharged from hospital.
One Iranian and one Ukrainian were confirmed dead.
Reports of the attack vary but it appears the attackers opened fire at the entrance where the X-ray machines are positioned, sparking an exchange with police. At least two ran into the building.
Footage on social media shows one moving through the building as people around him flee. He is shot by police and remains on the ground for about 20 seconds before blowing himself up. All three attackers were killed.
Analysis: BBC security correspondent, Frank Gardner
The lack of any immediate claim for this attack by so-called Islamic State is not surprising. IS rarely, if ever, claims responsibility for attacks against the Turkish state yet it is quick to advertise its assassinations of Syrian activists inside Turkey.
All the signs point towards IS being the culprits. This is what British counter-terrorism officials term “a marauding terrorist firearms attack”, following a pattern first seen in the Mumbai attacks of 2008.
The Istanbul targets were international air travellers and ground staff at an iconic location, the third busiest airport in Europe.
IS is targeting Turkey because it sees its government as being un-Islamic and too close to its Western allies in Nato. IS is also feeling the pressure as the Turkish authorities move to close down its networks inside Turkey.
Turkey’s other main foe, Kurdish separatists, have carried out many attacks over the years but their primary targets have tended to be Turkish policemen and soldiers.
Paul Roos, who was due to fly home to South Africa, told Reuters he saw one of the attackers.
“He was wearing all black. His face was not masked. We ducked behind a counter but I stood up and watched him. Two explosions went off shortly after one another. By that time he had stopped shooting.
“He turned around and started coming towards us. He was holding his gun inside his jacket. He looked around anxiously to see if anyone was going to stop him and then went down the escalator. We heard some more gunfire and then another explosion, and then it was over.”
#Pray for Turkey
Taxis were used to rush casualties to hospital after the attack. Desperate relatives of those missing later gathered outside a local hospital where many victims were taken.
Flights in and out of the airport were suspended after the attack. They have now resumed, but information boards showed about one-third had been cancelled, with many delays.
Charles Michel, the prime minister of Belgium whose capital city was targeted by bombers in March , tweeted from the EU summit in Brussels: “Our thoughts are with the victims of the attacks at Istanbul’s airport. We condemn these atrocious acts of violence.”
#PrayforTurkey began trending on Twitter after the attack.
Europe’s third-busiest in passenger traffic after London Heathrow and Paris Charles de Gaulle, serving 61.3 million passengers in 2015. World’s 11th busiest
Opened in 1924 in the Yesilkoy area, renamed in the 1980s after the nation’s first president, Mustafa Kemal Ataturk
Two passenger terminals: one domestic, one international
To be closed after the massive Istanbul New Airport – planned to be the largest in the world – opens in the Arnavutkoy district. Its first phase is due to be operational in 2017
Major recent attacks
7 June, Istanbul: Car bomb kills seven police officers and four civilians. Claimed by Kurdish militant group TAK
19 March, Istanbul: Suicide bomb kills four people in shopping street. IS blamed
13 March, Ankara: Car bomb kills 35. Claimed by TAK
17 February, Ankara: 29 killed in attack on military buses. Claimed by TAK
12 January, Istanbul: 12 Germans killed by Syrian bomber in tourist area
23 December, Istanbul: Bomb kills cleaner at Istanbul’s Sabiha Gokcen airport. Claimed by TAK
10 October, Ankara: More than 100 killed at peace rally outside railway station. Blamed on IS
20 July, Suruc, near Syrian border: 34 people
killed in bombing in Kurdish town. IS blamed
Courtesy of BBC