The 68-year-old cleric, almost always clad in his white turban, repeated his convincing 2013 victory by bringing together moderates and reformists with his pledges to end Iran's isolation and improve civil rights at home.
Born in Semnan province on November 12, 1948, Rouhani is married with four children and holds a doctorate in law from Scotland's Glasgow Caledonian University.
With his snow-white beard, he comes across as jovial and scholarly, if not overly charismatic, when speaking in public.
He has presented himself as the candidate of change and social freedoms, attacking his opponents as "extremists" whose "era is over".
His first term saw a groundbreaking 2015 deal with world powers that ended many sanctions and a 13-year standoff over Iran's nuclear programme.
He also brought a more technocratic approach to the economy and tamed runaway inflation.
But critics said he massively oversold the economic benefits of the nuclear agreement, and there were fears that continuing stagnation and high unemployment would hurt his re-election bid.
That proved unfounded as Rouhani sailed to victory against hardline challenger Ebrahim Raisi, winning 57 percent of the vote on Friday, on the back of a huge turnout.
His supporters hope another resounding victory will give him more leverage to ease social restrictions and release activists and opposition leaders jailed after mass protests in 2009.
'The diplomatic sheikh'
As Iran's nuclear negotiator in 2003-05, Rouhani earned the nickname "the diplomatic sheikh" from his European interlocutors, but that was also the start of criticism from hardliners at home who accused him of kowtowing to the West.
Before then, Rouhani had been firmly in the revolutionary establishment. He held key defence portfolios during the 1980-88 Iran-Iraq war before spending 16 years as secretary of the Supreme National Security Council, Iran's top security post.
When student protesters took to the streets in 1999, Rouhani called them "bandits and saboteurs" and most damningly "the corrupt of the Earth" -- a charge that carries the death penalty in Iran.
He remains a member of the conservative Association of Combatant Clergy, although his position on protesters seems to have softened over the years.
Rouhani consistently sought to rebuild relations with the United States, and became the first Iranian leader to speak with his counterpart in Washington when Barack Obama phoned in September 2013.
He has never been under any illusion about the difficulties of the relationship, telling US journalists in 2002: "America is not keen on independent countries... America is keen on countries that completely surrender themselves and act according to America's demands."
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)