Supreme Leader Ayatollah Ali Khamenei, the most powerful man in Iran, symbolically cast the election's first vote and called on Iranians to turn out in huge numbers for the poll.
"Elections are very important and the fate of the country is in the hands of all people," he said.
Associated Press journalists in Tehran, whose liberal and affluent voters form the bedrock of support for Rouhani, found lines at some precincts much longer than those seen in his 2013 win. Analysts have suggested a high turnout will aid Rouhani in securing a second four-year term.
Election officials twice extended the voting deadline beyond the anticipated 6 p.m. closing time to accommodate the large numbers of voters. Polls are now expected to close at 10 p.m.
"I am happy I could vote for Rouhani," said Zohreh Amini, a 21-year-old woman studying painting at Tehran Azad University. "He kept the shadow of war far from our country."
After casting his ballot, Rouhani said whomever the voters elect as president should receive all of the nation's support.
"Any candidate who is elected should be helped to accomplish this heavy responsibility," Rouhani said. "Anyone who is elected must be helped from tomorrow with unity, happiness and joy."
Rouhani has history on his side in the election. No incumbent president has failed to win re-election since 1981, when Khamenei became president himself.
That doesn't mean it will be easy, however. Rouhani faces three challengers, the strongest among them hard-line cleric Ebrahim Raisi, 56.
Raisi, a law professor and former prosecutor who heads an influential religious charitable foundation with vast business holdings, is seen by many as close to Khamenei. Raisi has even been discussed as a possible successor to him, though Khamenei has stopped short of endorsing anyone.
Raisi won the support of two major clerical bodies and promised to boost welfare payments to the poor. His populist posture, anti-corruption rhetoric and get-tough reputation — bolstered by his alleged role condemning inmates to death during Iran's 1988 mass execution of thousands of political prisoners — are likely to energize conservative rural and working-class voters.
"Rouhani has turned our foreign policies into a mess and damaged our religion," said Sedigheh Davoodabadi, a 59-year-old housewife in Iran's holy city of Qom who voted for Raisi. "Rouhani gave everything to the U.S. outright" in the nuclear deal.
After voting, Raisi told journalists that all should "completely surrender to the result of the election."
"If I, for instance, find the result undesirable, it should not lead to disruption of the election," he said.
Mostafa Hashemitaba, a pro-reform figure who previously ran for president in 2001, and Mostafa Mirsalim, a former culture minister, also remain in the race.