In Tehran, Rouhani told a crowd his election was a "victory of moderation over extremism," with about 72.2 percent of Iran's 50 million eligible voters casting ballots.
Supreme Leader Ayatollah Ali Khamenei - the theocratic ruler of Iran who determines the country's national security policy - congratulated Rouhani. "I urge everyone to help the president-elect and his colleagues in the government, as he is the president of the whole nation," he said.
Saturday concluded Iran's first presidential election since 2009, when the government violently repressed the "Green Movement" following Ahmadinejad's disputed re-election, which saw many protesters and dissenters jailed.
The White House said the election had occurred "against the backdrop of a lack of transparency" and media censorship. But in a statement the US said it was ready to "engage the Iranian government directly" to reach a diplomatic solution to the country's much-debated nuclear program.
The UK called on Iran's president-elect to "set Iran on a different course for the future: addressing international concerns about Iran's nuclear program... and improving the political and human rights situation for the people of Iran."
Rowhani, who had for 16 years been first secretary of Iran's Supreme National Security Council, supports Iran's nuclear aspirations, which suggests he's unlikely to challenge the status quo. And as Sharif Husseini, a member of Parliament, said, “nothing would change” because "these policies have been decided by the supreme leader."
The polling stations opened their doors at 8:30 a.m. local time to Iran's ballot-casters, and their hours were extended due to a "rush of voters," Mostafa Moammad Najar, Iran's interior minister, told FARS News Agency.
Iranians had six candidates to choose from, after two of the eight approved to compete by national election overseers dropped out of the race — leaving many voters conflicted over whether they should participate at all.
Former Iranian President Akbar Hashemi Rafsanjani was barred from running, angering many, although Rafsanjani had put out a formal call to voters to avoid a boycott on his behalf.
However, all six presidential contenders appealed to voters to remain calm while the votes were being counted.
"We ask people not to pay attention to rumors of victory parades being organized and to avoid gathering before the official results" are announced by the interior ministry, their statement said, according to Al Jazeera.
Hasan Rouhani, a former nuclear negotiator, was the only moderate in the race, and had been endorsed by two former presidents, both Rafsanjani and Mohammad Khatami.
Rouhani had been challenged by conservatives like Tehran's mayor Mohammad Baqer Qalibaf, chief nuclear negotiator Saeed Jalili, and former foreign minister Ali Akbar Velayati, none of whom were expected to put up much resistance against Khamenei's agenda.
The state of Iran's economy - which the president has influence over - had been a key issues during the elections, as international sanctions have put serious pressure on the country where both unemployment and inflation are rife.
Khamenei asked his people to turn out in large numbers to vote, but kept mum about his own preference — including on his Twitter account:
I also voted for one of these gentlemen in this election but no one is aware of my vote even my close friends & relatives #IranElection