Reformist-backed cleric Hassan Rouhani has won Iran’s presidential election, securing just over 50% of the vote and so avoiding the need for a run-off.
Tehran Mayor Mohammad Baqer Qalibaf was well behind in second place.
Turnout was estimated at 72.2% among the 50 million Iranians who were eligible to vote to choose a successor to Mahmoud Ahmadinejad.
Supreme Leader Ayatollah Ali Khamenei is scheduled to ratify the vote on 3 August.
The new president will then take the oath in parliament.
Interior Minister Mostafa Mohammad Najjar announced that Mr Rouhani had won 18,613,329 of the 36,704,156 votes cast. This represented 50.68% of the vote.
Mr Qalibaf won 6,077,292 votes to take second place.
Mr Najjar said that any presidential candidates unhappy with the results would have three days to lodge complaints to the Guardian Council.
The winning candidate needed more than 50% of all ballots cast, including invalid ones, to avoid a run-off.
Voting had been extended by five hours on Friday evening to allow more people to cast their ballots.
Although all six candidates were seen as conservatives, analysts say Mr Rouhani – a 64-year-old cleric often described as “moderate” who has held several parliamentary posts and served as chief nuclear negotiator – has been reaching out to reformists in recent days.
The surge of support for him came after Mohammad Reza Aref, the only reformist candidate in the race, announced on Tuesday that he was withdrawing on the advice of pro-reform ex-President Mohammad Khatami.
Mr Rouhani thus went into polling day with the endorsement of two ex-presidents – Mr Khatami and Akbar Hashemi Rafsanjani, who was disqualified from the race by the powerful Guardian Council, a 12-member body of theologians and jurists.
The hardline candidates included Mr Qalibaf – who is seen as a pragmatic conservative – and nuclear negotiator Mr Jalili – who is said to be very close to the Supreme Leader, Ayatollah Ali Khamenei.
The other three candidates were Mr Rezai, a former head of the powerful Revolutionary Guards, former Foreign Minister Ali Akbar Velayati, and former Telecommunications Minister Mohammad Gharazi.
One eligible voter, Mahdi, a software developer from Mashhad said he had not cast a ballot as he was “against the Islamic Republic”.
But he added: “Having said that, I hope Rouhani wins, because he is the best candidate… Rouhani won’t change things dramatically, he will probably only make things slightly better.”
After the last presidential election in June 2009, millions of Iranians took to the streets to demand a rerun, when the supreme leader dismissed claims by the three defeated candidates of widespread fraud.
Two of them, former Prime Minister Mir Hussein Mousavi and senior cleric Mehdi Karroubi, became leaders of a nationwide opposition known as the Green Movement, after its signature colour.
They were placed under house arrested in February 2011 when they applied to stage a protest in support of the anti-government uprisings which were sweeping the Arab world. They are still being detained.
No foreign observers monitored this year’s election and there have also been concerns that media coverage in the run-up has been unfair.
Many reformist newspapers have been shut down, access to the internet and foreign broadcasters has been restricted, and journalists have been detained.
On Thursday, the BBC accused the Iranian authorities of “unprecedented levels of intimidation” of BBC employees’ families.
It said Iran had warned the families of 15 BBC Persian Service staff that they must stop working for the BBC or their lives in London would be endangered.
Tehran has so far made no comment on the allegation.