On his website, the supreme leader said Rouhani is the president of all Iranians and told supporters of various candidates to set aside their differences and unify.
Rouhani has all-round credentials in Iran's institutions, including as a senior cleric and former commander of Iranian air defenses, and he is an intellectual with three law degrees, including from a university in Scotland.
He has a reputation for shunning extreme positions and bridging differences.
While he has represented Khamenei on Iran's security council since 1989, he has avoided being perceived as a pushover and has taken exception with the supreme leader on being too rigid toward the international community, according to an Iranian scholar at Stanford University. He has also accused state-run media of censorship and publishing lies.
Prior to Rouhani's election, Iran's Guardian Council, an unelected body made up of six clerics and six lawyers operating under the oversight of the supreme leader, drew up the restricted list of candidates from the 680 who initially registered.
Eight candidates were approved, two of whom subsequently dropped out. The final six contenders didn't include any women. Nor did they include Ahmadinejad's aide and protege Esfandiar Rahim Mashaei, who was among those excluded by the Guardian Council.