State television showed long queues outside polling stations in several cities.
Hardliner Ebrahim Raisi, 60, a close ally of Khamenei, is favourite to succeed the incumbent Hassan Rouhani, forbidden under the constitution from serving a third four-year term.
A win for the Shi'ite cleric would confirm the political demise of pragmatist politicians like Rouhani, weakened by the U.S. decision to quit the nuclear deal and reimpose sanctions in a move that stifled rapprochement with the West.
But it would not disrupt Iran's bid to revive the agreement and break free of tough oil and financial sanctions, Iranian officials say, with the country's ruling clerics aware their political fortunes rely on tackling worsening economic hardship.
"Raisi's main challenge will be the economy. Eruption of protests will be inevitable if he fails to heal the nation's economic pain," said a government official.
Khamenei appealed on Wednesday for a large turnout, saying such a show of strength would ease foreign pressure on the Islamic Republic.
Official opinion polls suggest turnout could be as low as 41%, significantly lower than in past elections.
Under pressure over rising inflation and joblessness, the clerical leadership needs a high vote count to boost its legitimacy, damaged after a series of protests against poverty and political restrictions across Iran since 2017.
Raisi's main rival is a pragmatist technocrat, former central bank governor Abdolnaser Hemmati, who says a win for any hardliner will result in yet more sanctions imposed by outside powers. Iran could hold talks with longtime arch-foe the United States if it adhered to "positive coexistence" with Iran, he said in the election campaign.
Raisi has crucial backing from Iran's Revolutionary Guards Corps, a powerful institution which over the years has opposed reformist initiatives, overseen the suppression of protests and used proxy forces to assert Iran's regional influence.
The mid-ranking cleric says he backs Iran's talks with six major powers to revive the nuclear deal, under which Iran agreed to curbs on its nuclear programme in return for the lifting of sanctions.
But Raisi, who shares Khamenei's suspicion of detente with the West, says only a powerful government can implement any revival of the pact.
Accused by critics of human rights abuses stretching back decades - allegations his defenders deny - Raisi was appointed by Khamenei to the high-profile job of judiciary chief in 2019.
A few months later, the United States sanctioned him for human rights violations, including the executions of political prisoners in 1980s and the suppression of unrest in 2009, events in which he played a part, according to human rights groups.
Iran has never acknowledged the mass executions, and Raisi himself has never publicly addressed allegations about his role.
(Reporting by Parisa Hafezi, Editing by William Maclean, Robert Birsel) ((firstname.lastname@example.org; +971 56 216 8363; Reuters Messaging: email@example.com; Twitter: https://twitter.com/PHREUTERS))