The first round results gave Rowhani 52 percent of the vote, more than three times as many as his nearest rival, with 18 percent of ballots counted, said the interior ministry.
A former top nuclear negotiator who has vowed to mend Iran's ties with the international community, Rowhani garnered nearly 2,720,000 votes from about 5,211,000 ballots counted by 9:00 am (0430 GMT), the ministry said.
Conservative Tehran mayor Mohammad Baqer Qalibaf was trailing him in second place with 17 percent.
More than 50.5 million Iranians were eligible to vote to find a successor to Ahmadinejad, who after serving two consecutive terms, was constitutionally barred from standing for re-election.
The authorities and media reported massive numbers of people turned out for Friday's election, with Rowhani benefitting from the withdrawal this week of the only other moderate candidate and the backing of former reformist president Mohammad Khatami.
If no candidate gets an overall majority of 50 percent plus one vote in the first round, the top two candidates will square off in a second-round run-off scheduled for June 21.
Rowhani, 64, led talks with world powers over Iran's controversial nuclear ambitions under Khatami's presidency.
During his tenure, in 2003, the Islamic republic agreed to suspend uranium enrichment. It was restarted after Ahmadinejad first became president in 2005.
Iran has been at loggerheads with world powers over its nuclear ambitions, which the West suspects is aimed at developing atomic weapons. The stand-off has resulted in the imposition of harsh economic sanctions and Tehran's international isolation.
While campaigning, Rowhani promised to move to ease those sanctions, which have led to severe economic pain in the country.
Inflation is raging at more than 30 percent, the Iranian currency, the rial, has lost nearly 70 percent of its value, and unemployment is rising.
On the votes counted so far, Rowhani is followed by Qalibaf with 17 percent; top nuclear negotiator Saeed Jalili with 13 percent; and ex-commander of the Revolutionary Guards Mohsen Rezai with 10 percent. All three of these candidates hail from conservative camps.
Jalili, Qalibaf and ex-former foreign minister Ali Akbar Velayati, another candidate who is behind with only five percent of the votes so far, are all considered close to supreme leader Ayatollah Ali Khamenei.
Rowhani, who boasts of close relations with moderate ex-president Akbar Hashemi Rafsanjani, also touts his relation with Khamenei, who has final decision on all key state issues, including the nuclear programme.
Rowhani represented Khamenei in the Supreme National Security Council, Iran' top security body, where he also served as its secretary for 16 years until 2005.
In the run-up to the disputed re-election of Ahmadinejad in 2009, official election results were quickly released. But in this campaign, counting of the votes has proved to be time consuming.
Earlier, Interior Minister Mostafa Mohammad Najjar said in the early hours of Saturday his electoral staff would not "compromise accuracy for speed".
Abbas Ali Kadkhodaei, the spokesman for the Guardians Council electoral watchdog, said late Friday that "no violation" had been reported whatsoever across Iran.
Ahmadinejad's re-election in 2009 sparked massive anti-regime street protests after his opponents and two reformist candidates Mir Hossein Mousavi and Mehdi Karroubi alleged wide-scale voting fraud.
Those protests, stifled by a brutal regime crackdown, led to the eventual detention under house arrest of Mousavi and Karroubi, and a widespread suppression of reformists.
Rowhani's surge in the campaign came after Khatami publically endorsed him, asking all his supporters to vote for the moderate candidate.
Khatami's endorsement also gave birth to an online movement, with social networkers urging abstentionists not to waste their votes this time around.
"I will vote for Rowhani, even though I do not know him at all and did not want to vote until yesterday," said a man named Ali on his Facebook page.
"I will vote because the consensus of those wanting to save Iran is on Rowhani."
Other net surfers have adopted Rowhani's official colour -- purple -- and his symbol of a key to open the door to solutions for Iran's problems.
COMMENTS (6)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ
Great. Now we have Pro-US govt on both sides. Lets perpetrate neocolonialism fir five more years.
@unbelievable:
Do not underestimate Iranian leadership. Agreement at state level are honoured irrespective of the change of faces. Iran is a great nation and will fulfill its pledges.
When bhutoo decided to build the bomb he was ready to offer people grass to eat Iran is much richer and united country.its people will eat grass but will not give up their nuclear programme Saudi king begged America to attack its nuclear facilities but America did not dare. It does not beg like pakistan and doesn't supply cleaners to Arabs like india does
I expect Roahani not to disappoint people who voted for him and perform different than his supporter ex Presidents Rafsenjani and Hatami.
@Raj-USA. You maybe correct but I suspect it might be a double edge sword. Removing sanctions might allow for IP financing but sanctions were a significant factor behind Iran's desire to sell gas to Pakistan. Without sanctions I expect Iran to take a tougher stand on pricing.
This could be a good news for Pakistan. If moderates win, Iran may abandon its nuclear ambition and sanctions may be lifted. IP gas pipe line may be allowed and even international financing could become available to Pakistan.