Dramatic television footage showed the moment the veteran diplomat was shot at the Ankara exhibition hall.
Andrei Karlov died of his wounds after the shooting, which occurred on the eve of a key meeting between the Russian, Turkish and Iranian foreign ministers on the Syria conflict.
Dramatic television footage showed the moment the veteran diplomat was shot as he opened a show of Russian photographs at the Ankara exhibition hall.
Images showed the ambassador standing up to speak at a lectern, before stumbling and crashing to the ground, lying flat on his back as the attacker -- dressed in a dark suit, white shirt and tie -- brandishes his gun at terrified onlookers.
The man shouts "Allahu Akbar" ("God is greatest") and then talks about pledging allegiance to jihad in Arabic, the images showed.
Switching to Turkish, he then says: "Don't forget about Syria, don't forget about Aleppo. All those who participate in this tyranny will be held accountable".
The state-run Anadolu news agency said the gunman had been "neutralised" in a police operation inside the hall after 15 minutes of clashes.
Turkish Interior Minister Suleyman Soylu identified the attacker as Mevlut Mert Altintas, 22, who had worked in the Ankara anti-riot police for the last two-and-a-half years.
"Today in Ankara as a result of an attack the Russian ambassador to Turkey Andrei Karlov received wounds that he died from," Russian foreign ministry spokeswoman Maria Zakharova said in televised comments.
"We qualify what happened as a terrorist act," she added. "The murderers will be punished."
"Today this issue will be raised at the UN Security Council. Terrorism will not win out."
The incident came after days of protests in Turkey over Russia's role in Syria, although Moscow and Ankara are now working closely together to evacuate citizens from the battered city of Aleppo.
The United States condemned the attack, while British ambassador Richard Moore paid tribute to a "quietly spoken, hospitable professional."
Erdogan phoned Putin to brief him about the attack, presidential spokesman Ibrahim Kalin said.
James Nixey, head of the Russia and Eurasia programme at Chatham House think tank in London, said Moscow will use the attack to step up actions in what the Kremlin sees as a "war on terror".
"My sense it that the Russians won't blame the Turks for this but will seek to capitalise on it for wider gains," he said.
"Clearly the Russian military will be baying for blood, they'll want revenge."
Turkey vowed it would not allow the assassination to damage relations with Moscow, which have dramatically improved in recent months.
"We will not allow this attack to cast a shadow on Turkey-Russia relations," said the Turkish foreign ministry in a statement.
Interior minister Soylu said the killing was "a terror attack on relations between Russia and Turkey".
The shooting took place at the Cagdas Sanatlar Merkezi, a major art exhibition hall in the Cankaya district of Ankara where most foreign embassies are located, including Russia's mission.
"When the ambassador was delivering a speech, a tall man wearing a suit, fired into the air first and then took aim at the ambassador," Hurriyet correspondent Hasim Kilic, who was at the scene, told AFP.
"He said something about Aleppo and 'revenge'. He ordered the civilians to leave the room. When people were fleeing, he fired again."
Protesters in Turkey have held Moscow responsible for human rights violations in Aleppo with thousands turning out for protests outside the Russian consulate in Istanbul.
Turkey and Russia saw relations plunge to their worst levels since the Cold War last year when a Turkish jet shot down a Russian war plane over Syria.
They stand on opposite sides of the Syria conflict with Ankara backing rebels trying to topple Moscow's ally President Bashar al-Assad.
But the rhetoric has warmed considerably since a reconciliation deal was signed earlier this year and a Russian and Turkish-brokered accord has helped the evacuation of citizens from Aleppo in the last days.
The attack came a day before the Turkish, Russian and Iranian foreign ministers were to hold unprecedented three-way talks on the Syria conflict in Moscow.
The Syrian foreign ministry in Damascus denounced the murder as a "despicable crime", state news agency SANA said.
Cavusoglu learned of the news while on the plane to Moscow and the meeting would go ahead as planned, Turkish officials said.
Born in 1954 in Moscow, Karlov was a career diplomat who had began his career under the USSR in 1976. He was Russian ambassador to North Korea from 2001-2006.