In the 1989 Iranian Supreme Leader election the Assembly of Experts members voted to choose the second Supreme Leader of Iran. The election was held on June 4, 1989, the morning after Ruhollah Khomeini's death. Ali Khamenei was elected as his successor with 60 votes out of 74.
Constitutional changes leading up to the election.
Because of a conflict of ideology between Ruhollah Khomeini and Hussein-Ali Montazeri, his accepted heir, Khomeini requested a revision of Article 109, which held that successors to Khomeini must be a "source of imitation" or having held the title of Marja'. The change to the constitution would not officially come until 6 August 1989, wherein a vote would reduce the qualification to having the authority to issue a fatwa. The debate within the Assembly of Experts on the constitutional change included whether the clerical qualification of Marjaʿiyyat present in Article 109 contributed to the quality of leadership Khomeini was seen as maintaining. The Assembly of Experts, made up of many people who were integral to the revolution of 1979 and in some cases knew Khomeini, concluded Khomeini's leadership was attributed in part to his religious qualifications, but mostly his political motivation and skill.
Election process.
The decision to hold the session was made on 3 June 1989, when Ahmad Khomeini phoned Akbar Hashemi Rafsanjani at around 3:00 pm to inform him that his father was in critical condition. When it became evident that choosing a successor would be necessary, Rafsanjani and Mohsen Rezaei called assembly members in the provinces to Tehran for an emergency meeting. The announcement of Ruhollah Khomeini's death was delayed until after the meeting.
Rafsanjani led the meeting in the next morning, and brought the sealed testament that was held in a safe. President Ali Khamenei read the will, after Ahmad Khomeini refused to do so because of grief. Reading the 35 pages of the testament will took roughly over two hours.
Supreme Leader versus Leadership Council.
The first matter brought up for discussion was whether the assembly should mandate a 'Leadership Council' or a single person. Several names were proposed as members of the council by proponents of a leadership council, including:
45 members voted in favor of a single person, and 23 against, who voted for a council leadership. Ali Khamenei and Akbar Hashemi Rafsanjani were both among advocates of a council.
Nomination of Mohammad-Reza Golpaygani.
After a single officeholder was voted over a council, Mohammad-Reza Golpaygani was proposed as the successor. He was considered a distinguished Marja', and after Hussein-Ali Montazeri was dismissed as the heir, he quickly emerged as the "leading candidate" in public discussions. However, Golpaygani was "utterly unknown to the general public" and lacked political experience. He finally received only 14 votes.
Nomination of Ali Khamenei.
After Golpaygani's vote did not meet the threshold, for the second attempt Ali Khamenei was considered and was chosen as the Supreme Leader. The national press wrote that he was chosen with 60 votes in favor, and 14 votes against. Ali Meshkini declared that he was chosen because of his close relations with Khomeini, and having played important roles both during the revolution and war, and due to his familiarity with social, economical and political issues; while Akbar Hashemi Rafsanjani claimed that Khomeini had wished on his deathbed that Khamenei succeed him. 
 ;templatestyles src="Rquote/styles.css"/ ;{ class="rquote pullquote floatright" role="presentation" style="display:table; border-collapse:collapse; border-style:none; float:right; margin:0.5em 0.75em; width:33%; " 
The details of the discussions regarding his nomination was kept a secret for decades. 
In 2008, excerpts of never-before-seen footage of the session was aired by the state-run Islamic Republic of Iran Broadcasting, showing that Akbar Hashemi Rafsanjani played a key role in persuading the assembly members to vote for Khamenei.
According to the testimony of Rafsanjani in the session, Ayatollah Khomeini had in a meeting in March 1989 pointed that Khamenei would be a suitable successor for him, responding to remarks that no other candidate exists for succession after the dismissal of Montazeri. As a result, Rafsanjani was widely credited as a "kingmaker".
 ;templatestyles src="Rquote/styles.css"/ ;{ class="rquote pullquote floatright" role="presentation" style="display:table; border-collapse:collapse; border-style:none; float:right; margin:0.5em 0.75em; width:33%; " 
Khamenei himself opposed the motion, stating "I support "shuray-e rahbari" [leadership council], according to the Constitution, and am opposed to "rahbari-ye fardi" [individual leadership]. How can I be a candidate?". He was responded to by Rafsanjani, ""rahbari-ye fardi" has become the law ("qanun shode"). There is no alternative." The video shows Khamenei leaving the podium, after saying "on this issue ... well, I am against it anyway", then Rafsanjani announces "Those in favor, stand up!" and an overwhelming majority stand while shouting 'God is great'.
The third part of the documentary Narrative of the Leadership which in February 2019 revealed that Khamenei had been temporarily elected to act as the Supreme Leader, until constitutional amendments were approved by the constitutional referendum. The assembly later reconfirmed its decision in July 1989, appointing him as the Supreme Leader.
References.
 ;templatestyles src="Reflist/styles.css" / ;