Iran's President Hassan Rouhani has been re-elected with an emphatic victory, official results show.
Out of more than 40 million votes cast, he received 57%, defeating his main rival, a conservative cleric.
Mr Rouhani, a moderate who agreed a deal with world powers to limit Iran's nuclear programme, pledged to "remain true" to his promises.
The decisive victory gives him a strong mandate to seek reforms and revive Iran's ailing economy, analysts say.
The president received close to 23 million votes, Interior Minister Abdul Reza Rahmani Fazli said on state television, in an election that had an unexpectedly high turnout of about 70%.
In his first remarks after winning the poll, Mr Rouhani said on Twitter (in Persian): "Great people of Iran, you're the winners of the election."
His main challenger, former prosecutor Ebrahim Raisi received 38.5%, or 15.7 million votes, not enough to take the election to a second round.
Voting time had been extended by five hours on Friday, until midnight. Election officials said the extensions were due to "requests" and the "enthusiastic participation of people".
The economy seems to be the number one challenge. Mr Rouhani, 68, signed a nuclear deal between Iran, the US and other countries in 2015.
International sanctions were lifted as a result, but average Iranians say they do not feel the economic benefits in their daily lives.
While oil exports have rebounded and inflation is back at single-digits, unemployment remains high, especially among the young people.
'Revenge against hardliners': By Kasra Naji, BBC Persian
Iran's hardliners had pulled all the stops and mobilised all their resources to bring out as many people as possible to grab the last centre of power in Iran that was not under their control, namely the executive branch.
Sensing an effort by the hardliners, supporters of President Rouhani who back his promises to steer the country toward moderation came out in big numbers too. Turnout has been unprecedented. In Tehran, five million people turned out to vote - twice as many as in 2013.
This was a revenge of the people against the hardliners who intimidated them, jailed them, executed them, drove them to exile, pushed them out of their jobs, and discriminated against women.
President Rouhani will now have a bigger mandate to push through his reforms, to put an end to extremism, to build bridges with the outside world, to put the economy back on track.
Iranians have said a resounding Yes to President Rouhani who, in recent years and particularly during the last several weeks of campaigning, promised to expand individual and political freedoms and make all those centres of power, like the Revolutionary Guard, accountable.
He also promised a moderate vision and an outward-looking Iran and, at rallies, openly attacked the conservative-dominated judiciary and security services.
Another challenge, experts say, will come from abroad, and the relations with the new US government. President Donald Trump opposes the nuclear deal which eased sanctions on the Middle Eastern country, but his White House renewed it earlier this week.