US President Donald Trump has previously said that he would "rip up" the nuclear deal.
The conservative-dominated Guardian Council must validate the results of election.
"The enthusiastic participation of Iranians in the election reinforces our national power and security", said Rouhani after casting his vote.
Supreme leader Ayatollah Ali Khamenei cast his vote at his compound in Tehran just minutes after polls opened, saying: "The destiny of the country is in the hands of Iranians".
Senior researcher at the Center of Middle East Studies of the Oriental Studies Institute of the Russian Academy of Sciences, Vladimir Sazhin, believes that Iran's policy has a very strong influence on the situation in the region and that the result of elections is extremely important.
"The country's fate is determined by the people". Raisi has even been discussed as a possible successor to him, though Khamenei has stopped short of endorsing anyone.
Rouhani, who struck a deal with world powers two years ago to curb Iran's nuclear program in return for the lifting of most economic sanctions, said the election was important "for Iran's future role in the region and the world".
Reform-minded supporters recognize that Rouhani isn't ideal - he too, after all, is also a cleric.
Near 63,500 polling stations across Iran opened on Friday morning.
Voter Mahya Kamalvan, 26, told CNN: "We can not complain if someone else is chosen. And then if anything happens the other way, maybe we can say something".
The contest is largely seen as a referendum on the incumbent president's more moderate political stance, which helped pave the way for the country's nuclear deal with world powers. "I hope we are not forced to leave the country", he said.
LeBron and Co cruise past Celtics in game one romp
The reigning National Basketball Association champion Cavaliers toyed with the Celtics in last night's 117-104 final at TD Garden. Stat F: LeBron James has played by far his most career playoff games against the Boston Celtics (30 games, 18-12, .600).
"It's the reason why I have [waited] about one hour in this line, in this hot weather".
Should Raisi win, Iran is expected to retreat from the kind of nascent global engagement seen during Rouhani's first term, with a focus on growing its economy internally rather than looking for direct foreign investment.
Raisi's history may deter some voters - the 56-year-old cleric was a member of the so-called "Death Commission", which presided over the summary executions of thousands of political prisoners in the summer of 1988.
But Rouhani won't necessarily benefit. "The thing is that conservatives, in other words, traditional population, usually take active part in the election campaign, while the electorate of pro-reformist direction never shows high turnout rates", she explained. They will choose the next president for a four-year term from among the four candidates.
If no-one wins more than 50% of votes cast, a run-off will be held next week. Since the deal went into effect, Iran has doubled its oil exports and inked multi-billion-dollar aircraft deals with Boeing and Airbus. Raisi accused Rouhani of "economic elitism, mismanagement, yielding to Western pressure, and corruption".
The official unemployment rate is 12.5%, and much higher for the university-educated.
"This Friday our nation will announce whether it wants to continue the path of peacefulness or path of tension", Rouhani said on Saturday.
The election comes at a tense moment in Iran's relations with the United States.
Ershan Nasroudi, 35, voiced a similar view.
The race has heated emotions and pushed public discourse in Iran into areas typically untouched in the tightly controlled state media.
At a campaign rally last week at the Azadi stadium in Tehran, Rouhani took to the stage and delivered a speech more worthy of an outsider than the incumbent. Rouhani promised in his 2013 campaign to free the men, but that pledge so far remains unfulfilled.
- Polls open with Iranians to give verdict on Rouhani
- Analysts Recommendations Frontier Communications Corporation (FTR)
- Pakistan moves ICJ to rehear Kulbhushan Jadhav case within six weeks
- LeBron, Love lead Cavs past Celtics
- Saudis not concerned about sharing intelligence with United States
- French elections 2017: Who is Emmanuel Macron?
- Always Dreaming is 4-5 favorite
- World's thinnest hologram will make screen size 'irrelevant'
- "Des limites ne seront pas imposées à la presse", assure l'Elysée
- Antonio Conte gets own Twitter emoji to celebrate Chelsea's title win