TEHRAN, Iran — Iran's supreme leader has formally endorsed Hasan Rouhani as president, opening the way for the moderate cleric to take over from outgoing President Mahmoud Ahmadinejad.

In a ceremony broadcast live on state television Saturday, Ayatollah Ali Khamenei gave his official approval for Rouhani. Khamenei, the ultimate authority in Iran, has final say in all key matters, including Rouhani's upcoming selections for key Cabinet posts such as the foreign and intelligence ministers.

Rouhani will take the oath of office in parliament Sunday.

Rouhani won a landslide victory in June 14 presidential elections. He has pledged to follow a "path of moderation" and promised greater openness over the country's nuclear program, which has placed it at odds with the West.

He replaces Ahmadinejad, first elected in 2005.