President Hassan Rouhani has an unbeatable lead in Iran's presidential election, an Iranian official source told Reuters, citing an early unofficial tally, and is set to defeat his hardline rival Ebrahim Raisi and win a second term.

In a briefing for reporters, interior ministry official Ali Asghar Ahmadi outlined a similar proportion of votes received.

"It's over, Rouhani is the winner," the source said on condition of anonymity.

The pragmatist Rouhani won 21.6 million votes in Friday's hard-fought contest, compared to 14 million for Raisi, with 37 million votes counted, the source said, adding about four million more votes were still to be tallied.

The interior ministry official said that with 25 million ballots certified by the authorities so far, Rouhani won 14.619 million and Raisi gained 10.125 million.

He said 40 million votes had been cast, indicating a turnout of about 70 percent, roughly similar to the showing in 2013 elections when Rouhani swept into office in a landslide victory

Ahmadi said final results would be announced later on Saturday.

The big turnout appeared to have favoured Rouhani, whose backers' main worry has been apathy among reformist-leaning voters disappointed with the slow pace of change.

Rouhani, 68, who took office promising to open Iran to the world and give its citizens more freedom at home, faced an unexpectedly strong challenge from Raisi, a protege of supreme leader Ali Khamenei.

The election is important "for Iran's future role in the region and the world", Rouhani, who struck a deal with world powers two years ago to curb Iran's nuclear programme in return for the lifting of most economic sanctions, said after voting.

Raisi, 56, has accused Rouhani of mismanaging the economy and has travelled to poor areas, speaking at rallies pledging more welfare benefits and jobs.

He is believed to have the backing of the powerful Revolutionary Guards security force, as well as the tacit support of Khamenei, whose powers outrank those of the elected president but who normally steers clear of day-to-day politics.

"I respect the outcome of the vote of the people and the result will be respected by me and all the people," Raisi said after voting, according to the semi-official Fars news agency.

However, Raisi later appeared at the Ministry of Interior in Tehran on Friday and complained of a shortage of ballot sheets at many polling stations, according to Fars. More ballot sheets were subsequently sent out, the agency reported.

The Guards and other hardliners had hoped that a win for Raisi would have given them an opportunity to safeguard economic and political power they see as jeopardised by the lifting of sanctions and opening of the country to foreign investment.

During weeks of campaigning, the two main candidates exchanged accusations of corruption and brutality in unprecedentedly hostile television debates. Both deny the other's accusations.

Rouhani has urged the Guards not to meddle in the vote, a warning that reflects the political tension. Suspicions that the Guards and the Basij militia under their control falsified voting results in favour of hardliner Mahmoud Ahmadinejad led to eight months of nationwide protests in 2009, which were violently suppressed.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.