Iran's Guardian Council has reinstated two leading reformists to the race for the presidency, state media reports.
Ayatollah Khamenei said voters should be offered a choice
Mostafa Moin and Mohsen Mehr Alizadeh had been barred from standing in the 17 June election along with all but six of more than 1,000 candidates.
But supreme leader Ayatollah Ali Khamenei ordered the council to change its mind.
Reformists had called for a boycott of the poll after the council's original decision, which they said was illegal.
According to state media, Guardian Council leader Ayatollah Ahmad Janati wrote to Ayatollah Khamenei to tell him his order would be followed.
"As you consider it desirable that all people in the country from different interests have the opportunity to take part... the competence of Mr Moin and Mr Mehr Alizadeh is recognised," he was quoted as writing.
The Council of Guardians vets all candidates for their moral values and support for the country's system of Islamic government.
Parliamentary polls last year were also mired in controversy after the Council barred about 2,500 reformist candidates.
Call for calm
However, Ayatollah Khamenei - as supreme leader - has overall authority in all political and spiritual matters and appoints the members of the Guardian Council.
A day after giving the order, Ayatollah Khamenei called on Iranians to participate in the election.
Mr Moin said his disqualification was "unfair and illegal"
He also urged candidates and their supporters to refrain from creating a divisive, tense and antagonistic climate.
The BBC's Pam O'Toole says Ayatollah Khamenei appears to be hoping the move will boost chances of widespread participation in the election, and offset the threat of major protests at a time when Iran is already under the international spotlight over its nuclear programme.
Choice for voters
On Monday, Mr Moin, a former education minister and the favoured candidate of the Islamic Iran Participation Front (IIPF), described his disqualification as "unfair, unreasonable and illegal".
Mostafa Tajzadeh, a senior IIPF member, told AFP: "I think the elections should be boycotted. This is definitely a coup d'etat."
Mr Mehr Alizadeh is currently a vice president in the cabinet of outgoing President Mohammad Khatami. Mr Khatami is barred by law from seeking a third consecutive term.
Former president and election favourite Akbar Hashemi Rafsanjani, four conservatives and a reformist make up the rest of the approved field of candidates.
The four hardliners are a former police chief, a former commander of revolutionary guards, the mayor of Tehran and a former head of state radio and television.
The remaining candidate is Iran's former parliamentary speaker Mehdi Karrubi, also a reformist.