Iranians poured into polling stations on Friday to vote in a tight presidential race with incumbent hardliner Mahmoud Ahmadinejad facing a tough challenge from moderate ex-premier Mir Hossein Mousavi.

Supreme leader Ayatollah Ali Khamenei urged Iranians to remain calm after an unusually impassioned election campaign marked by raucous street demonstrations and acrimonious mudslinging among candidates on prime time television.

The election has turned the spotlight on deep differences in the Islamic republic after four years under Ahmadinejad, whose fiery rhetoric further isolated Iran from the West while at home he has come under fire over the country's dire economic crisis.

Election officials have been predicting record turnout among the country's 46.2 million voters, half of whom were born after the 1979 Islamic revolution that toppled the US-backed shah.

"There have been a lot of people from the very beginning," election commision chief Kamran Daneshjoo told AFP. "The participation is unbelievable to us too. The winner is the Islamic republic and the people."

Ahmadinejad, 52, is battling for a second four-year term in office, while the 67-year-old Mousavi is seeking to make a comeback after two decades in the political wilderness.

Two other candidates, reformist former parliament speaker Mehdi Karroubi and the ex-head of the elite Revolutionary Guards Corps, Mohsen Rezai, are running far behind.

Analysts have been reluctant to forecast a winner, suggesting the vote may mirror 2005 when the relatively unknown Ahmadinejad scored a stunning upset in a second-round runoff against heavyweight cleric Akbar Hashemi Rafsanjani.

Daneshjoo said polling could be extended beyond the 6:00 pm closing time depending on turnout.

Khamenei, who has the final say on all Iran's strategic issues, urged people to vote but to remain "calm" and thwart any attempt to create "tension in polling stations."

The three-week election campaign highlighted a glaring internal divide, with towns and villages passionately backing Ahmadinejad and young men and women in big cities throwing their weight behind Mousavi.

"I voted because I want Iran to become green," said 45-year-old civil engineer who gave his last name as Behzadi, referring to the signature colour of Mousavi's campaign.

He said under the present government the private sector has been "paralysed," and highlighted the weak state of the economy, a key concern for many Iranians.

Civil servant Mehrab Ayoub, 28, said he voted for the incumbent.

"I always voted and will vote for the most competent, Ahmadinejad. He serves the people."

The next president will take power at a defining moment for Iranian foreign policy, with US President Barack Obama offering dialogue after three decades of severed ties but with continued deadlock with the West over its nuclear drive.

Mousavi has pledged to work to improve relations with the outside world, although there are doubts nuclear policy would change as all strategic decisions are taken by Khamenei.

Mousavi has complained that Ahmadinejad's foreign policy "undermined the dignity of Iran," and accused the president of mismanaging the economy.

OPEC's second biggest oil exporter is battling rampant inflation of 24 percent and a slump in earnings from crude oil as international prices have sunk from close to 147 dollars last year to around 72 dollars.

At a final campaign rally on Wednesday, Ahmadinejad, who has frequently described the Holocaust as a myth, accused his rivals of using "tactics like Hitler" to whip up public opinion against him.

If the blacksmith's son and former Tehran mayor is defeated, it will be the first time a sitting president has been ousted after a single term.

A runoff will be held on June 19 if no single candidate emerges with 50 percent plus one vote on Friday.

"A 50 percent voter turnout is good for Ahmadinejad, but if around 35 million voters come to the ballot boxes, then it is trouble for him," said political analyst Mashaallah Shamsolvaezin.

He said nearly 50 percent of the electorate are "silent voters" who are usually against the hardliners and if they vote in large numbers, it "could turn the game" against Ahmadinejad.

The elite Revolutionary Guards -- seen to be backing Ahmadinejad -- accused Mousavi supporters of trying to spark a "velvet revolution" by taking to the streets in their thousands.

"Such a scenario will never succeed in Iran due to the political structure of our Islamic nation. I believe that with the alertness of the people, any move for any velvet revolution will be nipped in the bud," Guards chief Yadollah Javani said in a media interview, referring to the non-violent overthrow in 1989 of the communist regime in then Czechoslovakia.

Keep up with the latest business news from the region with the daily Emirates Business 24|7 newsletter. To subscribe to the newsletter, please click here