Armed with a long-barrelled weapon, the attacker shot a police officer before storming the elite Reina club in the Ortakoy area of the city at about 1.45am. Describing the carnage as a "terror attack", Istanbul Governor Vasip Sahin said 35 people had died and 40 people were wounded.
Panic in the club
"Unfortunately (he) rained bullets in a very cruel and merciless way on innocent people who were there to celebrate New Year's and have fun," Mr Sahin said.
There were believed to be more than 500 people in the club at the time. Many party-goers threw themselves into the Bosphorus in panic after the attack and efforts were underway to rescue them from the waters, NTV television said.
The whereabouts of the attacker was still unknown and some reports suggested there were multiple attackers. Police special forces and explosives experts were searching the club, an NTV correspondent at the scene said.
Some witnesses claimed the attackers were "speaking Arabic", according to Dogan news agency.
As ambulances carried the wounded to hospitals, police in riot gear and machine guns backed up by armored vehicles blocked the area around the club.
New Year partygoers - including men in suits and women in cocktail dresses - were seen emerging from the nightclub in a state of shock.
'I had to lift several bodies'
"Before I could understand what was happening, my husband fell on top me," said Sinem Uyanik, who said she saw several bodies inside the Istanbul nightclub.
"I had to lift several bodies from on top of me before I could get out," she told the Associated Press.
Her husband Lutfu Uyanik was wounded in the attack but was not in serious condition.
Dozens of ambulances and police vehicles were dispatched to the club in Ortakoy, a neighbourhood on the city's European side nestled under one of three bridges crossing the Bosphorus and home to nightclubs, restaurants and art galleries.
"I didn't see who was shooting but heard the gun shots and people fled. Police moved in quickly," Sefa Boydas, a Turkish soccer player, wrote on Twitter.
"My girlfriend was wearing high heels. I lifted her and carried her out on my back," he said.
Obama offers help
US President Barack Obama expressed condolences for the attack and directed his team to offer US help to Turkish authorities, the White House said.
"This afternoon the president was briefed by his national security team on the attack in Istanbul," Eric Schultz, White House spokesman, said.
"The president expressed condolences for the innocent lives lost, directed his team to offer appropriate assistance to the Turkish authorities, as necessary, and keep him updated as warranted."
Ned Price, White House National Security Council spokesman, said the US condemned the attack.
"That such an atrocity could be perpetrated upon innocent revelers, many of whom were celebrating New Year's Eve, underscores the savagery of the attackers," he said.
Mr Price added: "We reaffirm the support of the United States for Turkey, our Nato ally, in our shared determination to confront and defeat all forms of terrorism."
The nightclub is one of the most elite spots in the city, and getting inside past the bouncers who seek out only the best dressed is notoriously hard.
Reina's owner, Mehmet Kocarslan, said security measures had been taken over the past 10 days after US intelligence reports suggested a possible attack, the Hurriyet newspaper reported.
British tourists warned
Turkish authorities have imposed a temporary blackout on coverage of the attack to prevent it spreading "fear in the public, panic and disorder".
NTV television said some of the wounded were foreign nationals, without citing their nationalities.
The British Foreign Office was attempting to find out whether any British nationals were injured in the attack.
"We are in touch with the local authorities following reports of an incident at a night club in Istanbul," a spokesman said.
The FCO said UK tourists should follow the advice of local authorities while remaining vigilant.
Turkey on alert
Security measures had already been heightened in major Turkish cities, with police barring traffic leading up to key squares in Istanbul and the capital Ankara.
In Istanbul, 17,000 police officers were put on duty, some camouflaged as Santa Clause and others as street vendors, Anadolu reported.
Turkey has been on high alert after being the target of a number of recent attacks by Islamic State of Iraq and the Levant (Isil) and Kurdish extremist groups.
On December 10, 44 people were killed in a double bombing in Istanbul after a football match hosted by the top side Besiktas.
That attack, which targeted a police bus, was claimed by the Kurdistan Freedom Falcons (TAK) seen as a radical offshoot of the PKK.
In March, at least 37 people died in a bombing at a bus stop in Ankara, an attack that was claimed by Kurdish militant group TAK, and in June, a suicide bombing at Istanbul airport killed 45 people. (By Chris Graham)