Mahmoud Ahmadinejad presented himself as a humble alternative
Mr Ahmadinejad won 62% of votes, defying predictions of a close race, to defeat the more moderate ex-President Akbar Hashemi Rafsanjani.
After his win, Mr Ahmadinejad said he planned to create a "modern, advanced and Islamic" role model for the world.
His victory means all the organs of the Iranian state are now in the hands of conservative hardliners.
Mr Ahmadinejad, 49, who campaigned on a conservative Islamic platform, had surprised observers by beating five other candidates in the first round to reach the run-off.
The BBC's Frances Harrison in Tehran says his taped statement, broadcast on state radio after the result was announced, was aimed at easing worries about his conservative views.
Some 22 million people voted in this run-off poll - a turnout of 60%, down from 63% in the first round a week ago.
Our correspondent says it was Mr Ahmadinejad's appeal to the poor that seems to be the secret to his success. Despite Iran's huge oil wealth the country has high unemployment and a big gap between rich and poor.
'Flawed' election
Mr Ahmadinejad has also pledged to tackle corruption and resist Western "decadence".
The US said the election was "flawed" and described it as "out of step" with regional trends towards democracy.
In Washington, a state department official said the US would judge Iran under Mr Ahmadinejad by its actions.
"In light of the way these elections were conducted, however, we remain sceptical that the Iranian regime is interested in addressing either the legitimate desires of its own people, or the concerns of the broader international community," the spokeswoman said.
UK Foreign Secretary Jack Straw said there were "serious deficiencies" in the election, noting that many reformists, and all women candidates, had been barred from standing.
"I hope that under Mr Ahmadinejad's presidency, Iran will take early steps to address international concerns about its nuclear programme" as well as its policies toward terrorism, human rights and the Middle East peace process, Mr Straw said in a statement.
'Profound humiliation'
Supporters of Mr Rafsanjani said before the result that victory for Mr Ahmadinejad would signal voting fraud.
Reformist candidates accused Iran's Revolutionary Guards and Basij security services of orchestrating a plot to boost Mr Ahmadinejad.
Interior ministry officials monitoring polling stations received some 300 complaints of electoral violations in Tehran alone, the Associated Press news agency reports.
The Islamic regime that has lost popular support is now seeking to renew itself by playing a new trick
M A Abdulqadir, Irbil, Iraq
Iranian election: Your views
The Guardian Council, which ran the poll, has dismissed allegations of election fraud.
Mr Ahmadinejad will be Iran's first non-cleric president for 24 years when he takes office in August.
Iran's supreme spiritual leader, Ayatollah Ali Khamenei, banned both camps from celebrating victory and urged people to keep off the streets.
He said the election result was a "profound humiliation" for the US.
'''Teheran (Iran), 25.06.2005''' - Der ultrakonservative Teheraner Bürgermeister Mahmud Ahmadinedschad hat die Stichwahl der iranischen Präsidentenwahl gewonnen. Das teilte das Innenministerium des Landes mit. Ahmadinedschad liegt nach Auszählung von zwei Dritteln der Stimmen mit 62,1 Prozent deutlich vor dem früheren Staatspräsidenten Akbar Haschemi-Rafsandschani, der als gemäßigter Konservativer gilt.

Die Wahlbeteilungung war mit knapp 57 Prozent geringer als beim ersten Wahlgang (63 Prozent). Der 49-jährige Bürgermeister der iranischen Hauptstadt profilierte sich mit Versprechungen an den großen Teil der armen Bevölkerung sowie mit Aussagen, er wolle die Korruption bekämpfen. Nach dem Sieg von Ahmadineschad dominieren Konservative alle politischen Organe im Iran. Zum ersten Mal seit der islamischen Revolution im Jahr 1979 fiel die Entscheidung in einer Stichwahl.