Iranian President Hassan Rouhani won a resounding victory in the 12th Presidential polls on Saturday as voters yearning for more freedom at home and less isolation abroad have emphatically backed the moderate cleric.
With a huge turnout, polling stations stayed open until midnight in parts of the country, defying concerns that moderates disillusioned by the weak economy or slow pace of change would not vote.
Iran's interior minister, Abdolreza Rahmani Fazli, announced live on state television that Rouhani received 23,549,616 votes (57 per cent), compared with his conservative rival Ebrahim Raisi, who won 15,786,449 votes (38.5 per cent).
More than 41.2 million people voted out of 56 million who were eligible to do so. The two other lesser known candidates, Mostafa Aqa-Mirsalim and Mostafa Hashemi-Taba, got 478,215 and 215,450 votes respectively.
No sitting president in Iran has failed to win a second term since 1981.
Ayatollah Seyyed Ali Khamenei, the top leader of the country, commended the Iranian people for their "massive and epic" turnout in the country's twin elections.
"The winner of yesterday's elections, is you (the Iranian people), and the Islamic establishment, which has managed to win the increasing trust of this big nation despite the enemies' plot and effort," Khamenei said.
Vice President Eshaq Jahangiri said: "I congratulate the great victory of the Iranian nation in creating a huge and memorable epic in the continuation of the path of 'wisdom and hope'," referring to the government's slogan.
The European Union foreign policy chief Federica Mogherini congratulated Rouhani on his re-election.
Mogherini said: "Iranians took passionately part to political life of their country. I congratulate President Hassan Rouhani for strong mandate received."
Despite the healthy margin of victory, Rouhan, 68, will face considerable hurdles, both at home and abroad, as he needs to demonstrate progress on overhauling the fragile economy. While he accomplished his goal of reaching a nuclear agreement with the US, China, Britain, France, Russia and Germany in his first term, that has not translated into the economic revival he predicted because of lingering unilateral US sanctions.
However, oil sales have rebounded since the deal took effect in January last year.
On the campaign trail, Rouhani had pledged to pursue talks with the US to lift further sanctions, and push for greater freedom inside Iran.
But the outcome of the election could have more immediate repercussions across the Middle East. Iran backs anti-Israel factions such as Lebanon's Hezbollah and has close ties with Syria's regime, which is opposed by the US and its regional allies.
Just as Iran's presidential vote took place, US President Donald Trump headed to Iran's main regional rival, Saudi Arabia, to begin a trip that will include a stop in Israel. Iran is expected to be a major topic of Trump's talks in both countries.
Despite increased tensions with the US since Trump's election, Rouhani sees Iran as benefiting from better ties with the West and from foreign investment. He has accused rivals of wanting to thwart progress.
Iran's President has important sway over domestic affairs and serves as the face of Iran to the world. But all key policies, such as diplomatic initiatives, must be cleared by Khamenei and his cadre of unelected leaders.