Iran's President Hassan Rouhani has won re-election with a resounding 57 percent of the vote, the interior minister announced on Saturday.
With 99.7 percent of ballots counted, Rouhani had 23.5 million votes compared to 15.8 million for challenger Ebrahim Raisi, Abdolreza Rahmani Fazli said on state television, adding that the results were final.
The result of the election throws down a challenge to the conservative clergy that still holds ultimate sway over the country.
Although the powers of the elected president are limited by those of unelected Supreme Leader Ayatollah Ali Khamenei who outranks him, the scale of Rouhani's victory gives the pro-reform camp a strong mandate.
Rouhani's opponent Raisi was a protege of Khamenei, tipped in Iranian media as a potential successor for the 77-year-old supreme leader who has been in power since 1989.
TRT World’s Abu Bakr al Shamahi has followed the race closely from Tehran.
The re-election is likely to safeguard the nuclear agreement Rouhani's government reached with global powers in 2015, under which most international sanctions have been lifted in return for Iran curbing its nuclear programme.
It also delivers a setback to the Revolutionary Guards, the powerful security force which controls a vast industrial empire in Iran. They had thrown their support behind Raisi to safeguard its interests.
Rouhani, known for decades as a mild-mannered member of the establishment, campaigned as an ardent reformist to stir up the passions of young, urban voters yearning for change. At times he crossed traditional rhetorical boundaries, openly attacking the human rights record of the security forces and the judiciary.
During one rally he referred to hardliners as "those who cut out tongues and sewed mouths shut". In a debate last week he accused Raisi of seeking to "abuse religion for power". The rhetoric at the debate earned a rare public rebuke from Khamenei, who called it "unworthy".
The big turnout appeared to have favoured Rouhani, whose backers' main concern had been apathy among reformist-leaning voters disappointed with the slow pace of change.
Many voters were particularly determined to block the rise of Raisi, one of four judges who sentenced thousands of political prisoners to death in the 1980s, regarded by reformers as a symbol of the security state at its most fearsome.
The election was important "for Iran's future role in the region and the world", Rouhani said on Friday after voting.
Raisi, 56, had accused Rouhani of mismanaging the economy, travelling to poor areas and holding rallies where he promised more welfare benefits and jobs.
Despite the removal of nuclear-related sanctions in 2016, lingering unilateral US sanctions that target Iran's record on human rights and terrorism have kept foreign companies wary of investing, limiting the economic benefits so far.