"I humbly bow my head down to you," Rouhani said to his people in a tweet translated from Farsi. "I will remain loyal to my promise to you."
Rouhani, who defeated his conservative challenger Ebrahim Raisi in the Friday elections, garnered 57% of the vote, Interior Minister Abdolreza Rahmani Fazli said. He'll serve another four years in the post.
"This hope with which you've entrusted me, I do feel the weight of this responsibility," Rouhani said in a televised address Saturday, "and I do pray to God to be a worthy carrier of your hopes and your dreams."
"His place among us in this morning of victory is quite empty," Rouhani said of Rafsanjani.
Rouhani, a moderate, was a key architect of the 2015 nuclear deal
with the United States, the European Union and other partners, and his first term was marked by an emergent international outreach.
The agreement has been controversial in both the United States and Iran, and it emerged as a top campaign issue, with the election seen in part as a referendum on the deal.
Raisi got 38% of vote
The victory reverberated in seats of power across the globe, on the Iranian streets and at the highest level of Iranian power. Among the first world leaders to issue congratulations to Rouhani were Syrian President Bashar al-Assad and Russian President Vladimir Putin.
US Secretary of State Rex Tillerson, who was traveling in Saudi Arabia with President Donald Trump, said the United States hopes Rouhani will end Iran's destabilization campaign in the region.
Tillerson also said he hopes Rouhani will end Iran's ballistic missile tests and restore the rights of free speech and assembly to Iran's citizens.
"If Rouhani wanted to change Iran's relationship with the rest of the world, that's what we would hope he would do," he told reporters in Riyadh.
In parts of Tehran, traffic stood still Saturday night as revelers honked horns and waved purple balloons to celebrate Rouhani's victory.
Iran's Supreme Leader Grand Ayatollah Ali Khamenei, communicating in a series of tweets, lauded the "high turnout" and called it "glorious and historic" for Iranian elections.
More than 40 million Iranian voters
flocked to polling stations Friday, according to the head of Iran's Interior Ministry State Elections Committee. More than 70% of eligible voters cast ballots
"A new record was set," he said, referring to presidential election turnout, and noted that the result "showed increasing progress of Iranian nation."
The victor of the elections were the Iranian people and the Islamic Republic establishment, "who despite enemy's efforts won the great nation's trust," Khamenei said.
Raisi -- who got 38% of the vote -- had been widely seen as Khamenei's preferred candidate. But Rouhani had history and hope on his side. No sitting president has failed to win a second term since 1981.
"I voted for Mr. Rouhani," said Mostafa, a voter in Tehran who spoke to CNN. "And I am proud of him because he showed all of the world we are a good country. Our goal is peace for our world. And I am proud of my President."
Rouhani's engagement with the outside world -- in spite of economic sanctions and visa restrictions -- resonated with voters, especially those in affluent areas
Iran aspires 'to live in peace' with world
In his address Saturday, Rouhani reached out to all citizens, from his supporters to his political rivals and detractors, and asked for their help.
"I do respect my political opposition," he said.
The election, he said, revealed the country's unity and was not an "opening for the deepening" of divides.
"The elections were the scene of a democratic event in order to peacefully resolve political, cultural and other issues of conflict that we may be grappling with," he said. "Our people in these elections, having understood the differing viewpoints, chose their path, and everyone must respect the wishes and will of the people."
Prevailing after the vote, he said, were the Islamic faith, freedom, independence and national self-reliance.
"No one can think of dividing us" along ethnic tribal, economic and geographical lines, he said.
Looking outside Iran's borders, Rouhani said his nation aspires "to live in peace and friendship with the rest of the world." But in a nod to tense relations
with its adversaries and rivals, he added that his country is "not ready or willing to be threatened or be sanctioned."
Nuclear deal at issue
Under the nuclear deal,
Iran would reduce its stockpile of low-enriched uranium by 98% and significantly scale back its number of installed centrifuges.
In exchange, the United States and the European Union would lift sanctions that have crippled the country's economy.
Rouhani has had a tough time defending the agreement, and his opponents have accused him of not making good on his promises.
He billed the deal as one that would thrust open the gates of economic opportunity, bring the country out of its isolation, and create millions of jobs for Iranians. The agreement has brought a string of billion-dollar deals with Western firms for airplanes and oil exploration in Iran.
But the benefits have been largely limited by a fall in global oil prices and US President Donald Trump's election, which introduced uncertainty for investors.
Trump has repeatedly threatened to rip up the nuclear deal.
For the average Iranian, the results so far have been lackluster, and Raisi repeatedly accused Rouhani of sacrificing Iran's sovereignty for a fool's bargain.
The election comes as Trump visits Saudi Arabia
, the heart of the Sunni branch of Islam.
The Saudis and other Gulf states hope Trump will take a harder line on Iran than his predecessor, President Barack Obama.
Putin, Assad send congratulations
Tensions have long festered between Sunnis and Shiites, particularly in Iraq, where Sunnis are a minority, and in Syria, where the Gulf states and Iran have backed different sides in the civil war there
Gulf states have been backing anti-government rebels.
Russia has been allied with Iran on behalf of Syrian President Bashar al-Assad's government. Its President, Vladimir Putin, sent a congratulatory telegram to Rouhani, the Kremlin said on its website.
"The Russian President also expressed confidence in the further successful implementation of the agreements, including those achieved during Hassan Rouhani's recent official visit to Russia, in the interests of the friendly peoples of the two countries, in the framework of efforts to maintain stability and security in the Middle East and the world generally," the Kremlin statement said.
Assad sent a cable
to Rouhani congratulating him "for the trust that was given to him by the Iranian People to continue strengthening Iran's position and its role in the region and the world as a whole."