His challenger, Mir Hossein Mousavi, is claiming irregularities. Police moved quickly to quell small protests.
Results of 47.3 percent of the vote, announced at 2 a.m., gave Mr. Ahmadinejad 67 percent of the vote, compared with 30.34 percent for Mir Hossein Mousavi, whose "green wave" of supporters had sparked popular street demonstrations during the campaign.
Mr. Mousavi argued that he had won an outright victory. "In line with the information we have received, I am the winner of this election by a substantial margin," he stated late on Friday.
Mousavi asked Iran's supreme religious leader, Ayatollah Sayed Ali Khamenei, to intervene.
At least three pro-Mousavi websites were shut down on Friday – along with that of the candidate himself. The results came through uncommonly quickly overnight, far faster than all elections of previous years.
In a statement Friday night on Fars news agency, Ahmadinejad's campaign said that "a golden page in the glorious history of the Islamic revolution has been witnessed." It praised the Iranian people for showing that while "reaching toward justice and fighting oppression, they will not stand down, and they will go against any darkness and filth."
Tears and anger on the street
Mousavi's loyalists – who had expected a victory over the divisive incumbent – were not buying the results. Police placed concrete barriers and several rows of police cars to block access to the Ministry of Interior, where votes were being tabulated and announced.
Hundreds of Mousavi supporters, frustrated, angry, and some with tears in their eyes, gathered in the front of the campaign headquarters in a state of shock.
"If there is rigging, Iran will be like judgment day!" they chanted. "Mousavi: Congratulations on your presidency!"
On Friday night, the mostly young Iranians who had flooded the streets with such abandon and political brashness during Iran's electrifying three-week campaign, were being chased outside the campaign headquarters by small groups of police and other security elements wielding batons and kicking, pepper-spraying, and punching people.
One diminutive young woman walked away from the after-midnight melee clutching her belly, where she had been hit, and sobbing. One man had boot marks on his arm where he had been kicked; another showed graze marks from a baton.
"I think this is psychological warfare," said one Mousavi supporter. "They want to scare us and give us the idea that we are losing."
It may have been working, as more results began to come out that showed Ahmadinejad with a commanding lead. The tumultuous, mud-slinging campaign and ever-growing street protests had prompted many analysts to predict a first-round victory for Mousavi.
First-ever debates focused on accusations and countercharges of lying over even basic statistics like inflation and employment figures. Playing on the theme, one Mousavi supporter early Saturday morning was despondent.
He said: "If they can play around with statistics, they can play around with votes."