After avoiding a run-off with a 57% outright victory over his main rival, Mr Rouhani said he respected his opponents’ right to criticise him. Mr Rouhani, 68, supports the landmark deal to curb Iran’s nuclear programme.
The decisive victory gives him a strong mandate to seek reforms and revive the country’s ailing economy, analysts say.
“The Iranian nation has chosen the path of interaction with the world, a path which is distant from extremism and violence,” Mr Rouhani said in his first speech after the victory, broadcast on state television.
“The election is now over. I am the president of the nation and need assistance from every single Iranian, even those who oppose me and my policies.”
Mr Rouhani also thanked former reformist President Mohammad Khatami, apparently defying a media ban on citing the ex-leader’s name.
Turnout in the election was unexpectedly high, at about 70%. And this is thought to have helped Mr Rouhani, who received close to 23 million votes out of the 40 million that were cast. His main challenger, former prosecutor Ebrahim Raisi received 38.5%, or 15.7 million votes, which was not enough to take the election to a second round.
Iran’s Supreme Leader, Ayatollah Ali Khamenei, said the election had showed the “increasing progress” of the “Iranian nation”. Mr Khamenei said Iran would demonstrate “national dignity” and “wisdom” in relations with other countries. But he did not congratulate Mr Rouhani for his victory.
There were celebrations in the capital, Tehran, with young people singing and dancing in the central Vali Asr Square, despite efforts by police to move them, the AFP news agency reported.
Of all the challenges President Rouhani will face, the economy seems to be the number one issue with the voters. Average Iranians say they do not feel the economic benefits after international sanctions were lifted as a result of a nuclear deal signed between Iran, the US and other countries in 2015.
While oil exports have rebounded and inflation is back at single-digits, unemployment remains high, especially among young people.
Mr Rouhani also promised a moderate vision and an outward-looking Iran and, at rallies, openly attacked the conservative-dominated judiciary and security services. But Mr Rouhani’s own powers are limited by those of Ayatollah Khamenei, who has the last say on many crucial and strategic issues.
Another challenge, experts say, comes from abroad, and relations with the new US government under President Donald Trump.
Mr Trump opposes the nuclear deal which eased sanctions on the Middle Eastern country, describing it as the “worst deal ever”. But, despite the objections, the White House renewed the agreement earlier this week.
Iran’s hardliners had pulled out all the stops and mobilised all their resources to bring out as many people as possible to grab the last centre of power in Iran that was not under their control, namely the executive branch.
Sensing an effort by the hardliners, supporters of President Rouhani who back his promises to steer the country toward moderation came out in big numbers too. Turnout has been unprecedented. In Tehran, five million people turned out to vote – twice as many as in 2013.
This was a revenge of the people against the hardliners who intimidated them, jailed them, executed them, drove them to exile, pushed them out of their jobs, and discriminated against women.
President Rouhani will now have a bigger mandate to push through his reforms, to put an end to extremism, to build bridges with the outside world, to put the economy back on track.
Iranians have said a resounding Yes to President Rouhani who, in recent years and particularly during the last several weeks of campaigning, promised to expand individual and political freedoms and make all those centres of power, like the Revolutionary Guard, accountable.
The results were announced as Mr Trump arrived in Saudi Arabia, Iran’s biggest regional rival, for his first foreign visit to the region as president. In Riyadh, US Secretary of State Rex Tillerson said he hoped Mr Rouhani would use his new term to “dismantle a network of terrorism and end his country’s ballistic missile programme”.
But Iran denies any involvement in terrorism and says its missile programme, which has recently been targetted by Mr Trump with new sanctions, does not breach UN resolutions.
Saudi Arabia’s Foreign Minister Adel al-Jubeir described the election as a “domestic matter”, but went on to accuse Iran of “meddling in Arab countries” and providing support for the extremist group al-Qaeda.
Meanwhile, the EU foreign policy chief, Federica Mogherini, congratulated Mr Rouhani for the “strong mandate received” and said that Europe was ready to work for better “engagement” and “regional peace”.