In Tehran, Ahmadinejad won 58.5 percent and Hashemi-Rafsanjaninearly 40 percent.
The Guardians Council has still to validate the results.
Ahmadinejad, a former member of Iran's Revolutionary Guard, was a relatively unknown figure in Iran until he reached the run-off last week. But on 24 June, Ahmadinejad swept to a resounding victory.
Ahmadinejad's campaign manager said on 25 June that supporters of the conservative candidate will go to mosques to "thank God for this great victory." No street celebrations are planned, however.
Ahmadinejad is said to be a strict follower of conservative Islamic principles who has promised to improve the lot of the poor. Reports indicate that Ahmadinejad, who has promised to share Iran's oil wealth more fairly, performed particularly well in the country's poorest areas. An Interior Ministry official told Reuters that "poor provinces have voted massively for Ahmadinejad."
On 24 June, Ahmadinejad promised Iran a new era if he was elected and called himself "a little servant and a street sweeper" for the people.
"Today, God willing, is the start of a new era in the political life of this country," Ahmadinejad said. "The enthusiastic and intelligent participation of the people in the first round ballot and today in the second round vote, God willing, will be the start of a new movement that will lead this nation to the peak of development and progress."
Ahmadinejad will succeed reformist President Mohammad Khatami, who constitutionally could not seek a third term.
His victory gives hardliners control over every elected or unelected state institution in Iran. They gained control over the parliament during last year's parliamentary elections.
His victory is a major blow to Iran's reformist camp, which had called on supporters to vote for Hashemi-Rafsanjani to prevent Ahmadinejad from taking power. They had expressed concern that an Ahmadinejad presidency would roll back reforms.
There has been no reaction yet from the reformist wing or from the defeated Hashemi-Rafsanjani.
But the conservative parliamentary speaker, whose party ("Abadgaran") supports Ahmadinejad, welcomed the election results "a victory for the Iranian nation." Gholamali Hadad Adel said Ahmadinejad's victory is not a victory for extremism.
On 24 June after casting his vote, the pragmatic Hashemi-Rafsanjani said that there would "be no problems for the country" if he loses.
But he said he still plans to play a role in Iran's politics:
"In any case, I am determined to serve the revolution and the people until the end of my life. At the current time, regardless of being president or not, my aim is to play a political role in history," Hashemi-Rafsanjani said.
Washington on 24 June condemned the Iranian elections as flawed and said that Iran is "out of step" with regional trends toward democracy.
U.S. State Department spokeswoman Joanne Moore is quoted by Western agencies as saying: "With the conclusion of the election in Iran, we have seen nothing that dissuades us from our view that Iran is out of step with the rest of the region and the currents of freedom and liberty that have been so apparent in Iraq, Afghanistan, and Lebanon."
Some observers believe that Ahmadinejad's victory complicates any prospects of improvement of ties between Tehran and Washington.
Ahmadinejad said before the 24 June vote that ties with the United States would not solve people's problems.
(Radio Farda/agencies)See also:
A New Generation And The Drift To The Right
Ethnicity And Regional Interests Play Out In Vote
For RFE/RL's full coverage of Iran's elections, see "Iran Votes 2005"