The Supreme Leader position was created by the 1979 Islamic Revolution, and the first to hold this title was Ayatollah Ruhollah Khomeini. There has only been one other supreme leader, Ayatollah Ali Khamenei, who took power the day after Khomeini died and has been ruling ever since. The Supreme Leader has final control over all things in Iran: politics, judicial appointments, religion, media, military, foreign policy, and the presidency. The position is appointed by the Assembly of Experts, which ranks lower in the power structure.
The next highest body in Iranian politics is the Guardian Council. This body of 12 jurists decides which legislation is permissible under Islamic law and which candidates may run for president or parliament. Six members of the Guardian Council are directly appointed by the supreme leader, and the other six are recommended by the head of the judiciary -- appointed by the supreme leader -- and forwarded to parliament for certain approval. Under Iran's constitution, the supreme leader can appoint or dismiss Guardian Council jurists at will. The Guardian Council is known for arbitrarily rejecting the candidacy of large numbers of Iranians at a time, mostly reformists, leading to a heavily censored ballot for Iranians to choose from.
After the Guardian Council comes the Assembly of Experts. This is a panel of 86 Islamic scholars that is supposed to oversee the activities of the supreme leader. They are elected to eight-year terms after the Guardian Council has screened and allowed them to appear on public ballots. The assembly meets twice a year for two-day sessions, under Iran's constitution. Scrutiny of the supreme leader in truth, though, is barely existent, and the assembly usually just calls upon the supreme leader to solicit his advice.
Next in the power structure is the Expediency Council. This was established in theory to resolve disputes between the Guardian Council and the country's parliament, but operates more in an advisory role to the supreme leader. The Expediency Council is appointed every five years by the supreme leader. The council also helps the supreme leader control the other branches of government, including the presidency.
And the president is the next lower step in the Islamic Republic's hierarchy. The president is selected by general election from a ballot approved by the Guardian Council (in 1997, the Guardian Council approved only 4 out of 238 presidential candidates), and serves for not more than two four-year terms. While the main face representing Iran at world events, treaty signings, etc., the president is absolutely subordinate to the supreme leader. The president is also head of the Council of Cultural Revolution and the Council of National Security. The president does not control the armed forces or other key elements of the government.
Last comes the parliament, or the Majlis. The current Majlis has 290 members selected by general election from a ballot handpicked by the Guardian Council and serve for four-year terms. Five members represent non-Muslim minorities. The Majlis may draft, debate and pass legislation, but nothing becomes law without approval of the Guardian Council.