State media declared President Mahmoud Ahmadinejad the winner of Iran's election on Friday, but challenger Mirhossein Mousavi alleged irregularities and claimed victory for himself.
The head of the state election commission said Ahmadinejad was leading Mousavi by 69 percent to 28 percent with about 19 percent of ballots counted.
The official news agency IRNA said: Dr Ahmadinejad, by winning most votes at the 10th presidential election, has secured his victory.
Mousavi had earlier tried to pre-empt official announcements by calling a news conference at which he alleged there had been irregularities, including a shortage of ballot papers.
I am the definite winner of this presidential election, he declared.
There was no immediate response from Mousavi to the election commission's figures.
A bitterly fought campaign has generated intense excitement inside Iran and provoked strong interest around the world, with policymakers looking for signs of a change of approach by Tehran, whose ties with the West worsened under Ahmadinejad.
A victory for Mousavi could help ease tensions with the West, which is concerned about Tehran's nuclear ambitions, and improve chances of engagement with U.S. President Barack Obama, who has talked about a new start in ties with Tehran.
Mousavi, a former prime minister, said many people had not been able to cast their ballots even after voting was extended by four hours.
Earlier, in Washington, Obama said his administration was excited about the debate taking place in Iran and he hoped it would help the two countries to engage in new ways.
Mousavi, at his news conference, listed problems with the voting process.
(We) are waiting for the counting of votes to officially end and explanations of these irregularities be given, Mousavi said. We expect to celebrate with people soon.
We hope that authorities in charge do their work in this regard with the wisdom of the supreme leader this issue would end in a good way.
Under the election rules, if no candidate wins 50 percent of the votes, a run-off will be held on June 19 between the two front-runners.
Long queues had formed at voting centers, both in northern, affluent areas of Tehran where Mousavi draws support and in southern, poorer neighborhoods seen as Ahmadinejad strongholds.
High turnout could indicate voting by many pro-reformers who stayed away when Ahmadinejad won four years ago on a pledge to revive the values of the 1979 Islamic revolution. Political analysts have said they expect a close race.
For Iranians it is a chance to pass judgment on his management of the Islamic Republic's oil exporting economy.
Although Ahmadinejad, 52, says his government has revived economic growth and curbed price rises, inflation and high unemployment were the main campaign issues. Official inflation is around 15 percent.
Social issues, such as strict dress codes for women, as well as Iran's ties with the outside world, also featured in the campaign but the outcome of the vote will not bring a major shift in Iran's foreign policy, which is determined by Supreme Leader Ayatollah Ali Khamenei.
The United States has had no ties with Iran since shortly after the revolution but Obama said in Washington that the United States had tried to send a clear message that we think there is the possibility of change in relations.
Mousavi, 67, rejects Western demands that Iran halt uranium enrichment but analysts say he would bring a different approach to Iran-U.S. ties and talks on Tehran's nuclear program, which the West fears is a cover to build bombs. Iran denies this.
People's strong, revolutionary and clear decision will bring about a bright future for the nation, Ahmadinejad, a self-styled champion of the poor with strong support in rural areas, said while voting in a working class part of Tehran.
The three-week election campaign was marked by mudslinging, with Ahmadinejad accusing his rivals of corruption. They said he was lying about the state of the economy.
Ahmadinejad's election rivals, who also include liberal cleric Mehdi Karoubi and former Revolutionary Guard leader Mohsen Rezaie, have urged the Interior Ministry and Khamenei to ensure there is no vote rigging.
Mousavi's wife Zahra Rahnavard broke new ground in the conservative Islamic state by actively campaigning for her husband, a move hailed by women's rights activists.
I thank all the people for their green presence which created a miracle, Mousavi said, referring to the colors worn by his backers who thronged Tehran streets during the campaign, as he voted in Tehran with his wife at his side.
(Additional reporting by Hossein Jaseb and Hashem Kalantari; writing by Fredrik Dahl and Dominic Evans; editing by Mark Trevelyan)