The assailant shot dead a police officer and a civilian as he entered the Reina nightclub before opening fire at random inside.
A gunman shot his way into an Istanbul nightclub packed with New Year's revellers early on Sunday, killing at least 39 people and wounding 69 in what the provincial governor described as a terrorist attack.
"A terrorist with a long-range weapon ... brutally and savagely carried out this incident by firing bullets on innocent people who were there solely to celebrate the New Year and have fun," Istanbul governor Vasip Sahin told reporters at the scene.
Turkish security forces are still searching for the terrorists behind the attack.
Around 500 to 600 people were thought to have been inside when the gunman opened fire at around 1:15 am local time (2230 GMT), the Istanbul governor further said. Some jumped into the waters of the Bosphorus to save themselves and were rescued by police.
Turkish Justice Minister Bekir Bozdag tweeted: "This is a treacherous terror attack on Turkey. No terrorist attack will destroy our unity, destroy our brotherhood."
3)Bu;Trkiye'mize,huzurumuza,birliimize,kardeliimize ve hepimize yaplm kalle ve hain bir terr saldrsdr.— Bekir Bozda (@bybekirbozdag) January 1, 2017
4)Hibir terr saldrs;birliimizi bozamayacak,kardeliimizi yok edemeyecek,Trkiye'nin terrle etkin mcadelesini zaafa uraamayacaktr— Bekir Bozda (@bybekirbozdag) January 1, 2017
Istanbul saw several attacks in 2016, the latest on December 10, when two bombs claimed by PKK affiliated TAK terrorist group exploded outside a soccer stadium, killing 44 people and wounding more than 150.
In June, around 45 people were killed and hundreds wounded as three Daesh-linked terrorists carried out a gun and bomb attack on Istanbul's main Ataturk airport.