Iran's state television has declared incumbent President Hassan Rouhani the winner of the country's presidential election, giving him a second four-year term to see out his agenda calling for greater freedoms and outreach to the wider world.
State TV offered its congratulations in a brief statement Saturday, based on vote tallies.
The 68-year-old has come to embody more liberal and reform-minded Iranians' hopes for greater political freedom at home and better relations with the outside world.
Preliminary vote tallies earlier had Rouhani ahead with 22.8 million votes, out of 38.
A huge turnout yesterday -- estimated at more than 40 million out of 56 million registered voters -- led to the vote being extended by several hours to deal with long queues.
"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'," tweeted Vice President Eshaq Jahangiri, referring to the government's slogan.
Rouhani, a 68-year-old moderate cleric who spearheaded a 2015 nuclear deal with world powers, has framed the election as a choice between greater civil liberties and "extremism".
Hardline cleric Raisi, 56, had positioned himself as a defender of the poor and called for a much tougher line with the West.
But his revolutionary rhetoric and efforts to win over working class voters with promises of increased handouts appear to have gained limited traction.
"Rouhani's vote, particularly in rural areas, shows that Iranian people no longer believe in economic populism and radical change," said Ali Vaez, Iran analyst for the International Crisis Group, a think tank.
"They have the maturity to understand that the solution to their country's predicaments are in competent management of the economy and moderation in international relations," Vaez told AFP.
Rouhani's central first-term achievement was a deal with six powers led by the United States that eased crippling economic sanctions in exchange for curbs on Iran's nuclear programme.
He gained a reprieve this week when Washington agreed to continue waiving nuclear-related sanctions, keeping the deal on track for now.
But the election comes at a tense moment in relations with the United States, with President Donald Trump still threatening to abandon the accord and visiting Iran's bitter regional rival Saudi Arabia this weekend.
Although Rouhani has been deeply entrenched in Iran's security establishment since the early days of the revolution, he has emerged as the standard-bearer for reformists after their movement was decimated in the wake of mass protests in 2009.
"We've entered this election to tell those practising violence and extremism that your era is over," he said during the campaign.
At recent rallies, his supporters chanted the names of reformist leaders under house arrest since 2011 for their part in mass protests two years earlier.
International affairs researcher Foad Izadi, of Tehran University, said Rouhani may now have the leverage to push for more freedoms, despite opposition from the conservative- dominated judiciary and security services.