Moderate cleric Hassan Rowhani was declared Iran's new president on Saturday in an surprise outright election victory that ends eight years of conservative grip on the top office.
"This victory is a victory for wisdom, moderation and maturity... over extremism," local media reported Rowhani as saying in a first statement after his win.
Rowhani, 64, a former top nuclear negotiator who has championed more constructive engagement with world powers, won outright with 18.6 million votes, or 50.68 percent of those cast, the interior minister said.
AFP journalists said crowds marched through Vali-Asr Square in central Tehran carrying pictures of the winner and chanting pro-Rowhani slogans.
In northwest Tehran, people in Kaj Square cheered as passing cars sounded their horns in approval.
Announcing Rowhani's win, Interior Minister Mohammad Mostafa Najjar said 36.7 million people, or 72.7 percent of the electorate, had voted on Friday.
Current President Mahmoud Ahmadinejad was constitutionally barred from standing again after serving two consecutive terms.
Rowhani's tally was enough to ensure there would be no run-off against the runner-up, Tehran Mayor Mohammad Baqer Qalibaf, who came a distant second with 6.07 million votes.
Rowhani has pledged "no surrender" to Western demands in talks on Iran's controversial nuclear programme but has promised a more constructive, less adventurist approach.
Supreme leader Ayatollah Ali Khamenei's website congratulated Rowhani on his victory and urged the people to work with him.
"Congratulations to the people and to president-elect Hojatoleslam Hassan Rowhani," Khamenei's Internet site leader.ir reported.
"I urge everyone to help the president-elect and his colleagues in the government, as he is the president of the whole nation."
Internationally, France said it was "ready to work" with Rowhani.
"The expectations of the international community with regard to Iran are significant, especially about its nuclear programme and its involvement in Syria," French Foreign Minister Laurent Fabius said in a statement.
Britain urged him to set the Islamic republic "on a different course".
"We call on him to use the opportunity to set Iran on a different course for the future: addressing international concerns about Iran's nuclear programme, taking forward a constructive relationship with the international community, and improving the political and human rights situation for the people of Iran," a Foreign Office spokesman said.
The key opposition Syrian National Coalition umbrella grouping urged Rowhani to review support for the Syrian regime.
It urged him to "rectify the mistakes made by the Iranian leadership", referring to Tehran's staunch backing for Syrian President Bashar al-Assad.
Iran's current nuclear negotiator with world powers, Saeed Jalili, came a distant third in the election with 3.17 million votes.
Rowhani has vowed to restore diplomatic ties with arch-foe the United States, which cut relations in the aftermath of the 1979 seizure of the US embassy by Islamist students.
He inherits an economy that has been badly hit by EU and US sanctions targeting the key oil and banking sectors because of its nuclear programme.
Friday's election was the first since the disputed 2009 re-election of Ahmadinejad triggered massive street protests by supporters of his rivals, that were crushed in a deadly crackdown.
In 2003, when Rowhani was top nuclear negotiator under Khatami, the Islamic republic agreed to suspend its controversial enrichment of uranium.
But that programme resumed two years later when Ahmadinejad was first elected.
Iran has been at loggerheads with world powers over its nuclear drive, which the West suspects is aimed at developing an atomic weapon capability.
Tehran denies the charge, but the sanctions imposed over the stand-off have isolated it internationally.
In campaigning, Rowhani pledged to move to ease the sanctions, which have hit hard -- inflation is more than 30 percent, the rial has lost nearly 70 percent of its value, and unemployment is rising.
The economy formed the focus of voters' concerns.
"We expect the new president to improve the economy so that it gets better and better," said Tehran resident Farshid Hassan Zade ahead of the results.
Rowhani touts his relations with the supreme leader, who has the final say on all key issues, including the nuclear programme.
Rowhani is a representative of Khamenei on the Supreme National Security Council, Iran's top security body, and was its secretary for 16 years until 2005.
Tehran resident Ali Yousefi said after voting on Friday: "I think that there was a great level of participation in this election, which shows that people will show up when they should and turn everything to their favour."
The 2009 protests that followed Ahmadinejad's re-election led to the eventual detention under house arrest of opposition candidates Mir Hossein Mousavi and Mehdi Karroubi, and the widespread suppression of reformists.
Khatami's endorsement of Rowhani for president gave birth to an online movement, with social networkers urging abstentionists not to waste their votes.
Rowhani, married with four children, holds a doctorate in law from Scotland's Glasgow Caledonian University, according to his official CV.