The vote comes amid heightened regional tensions. In April, Iran launched its first direct attack on Israel over the war in Gaza, while militia groups that Tehran arms in the region - such as the Lebanese Hezbollah and Yemen's Houthi rebels - are engaged in the fighting and have escalated their attacks.
Iran is also enriching uranium at near weapons-grade levels and maintains a stockpile large enough to build several nuclear weapons, should it choose to do so. And while Khamenei remains the final decision-maker on matters of state, whichever man ends up winning the presidency could bend the country's foreign policy toward either confrontation or collaboration with the West.
The campaign also repeatedly touched on what would happen if former US president Donald Trump, who unilaterally withdrew America from the Iran nuclear deal in 2018, won the November election.
Iran has held indirect talks with President Joe Biden's administration, although there has been no clear movement back toward constraining Tehran's nuclear programme for the lifting of economic sanctions.
Iran's supreme leader Ayatollah Ali Khamenei casts his ballot during the presidential runoff elections in Tehran
AFP via Getty Images
More than 61 million Iranians over the age of 18 were eligible to vote, with about 18 million of them between 18 and 30. Voting was to end at 6pm but was extended until midnight to boost participation.
The late president Ebrahim Raisi, who died in a May helicopter crash, was seen as a protege of Ayatollah Khamenei and a potential successor as supreme leader.