The 2015 deal, previously criticised by Donald Trump, saw Iran's nuclear programme limited in exchange for the lifting of some sanctions.
Supreme Leader Ayatollah Ali Khamenei, the most powerful man in Iran, symbolically cast the election's first vote.
"Elections are very important and the fate of the country is in the hands of all the people", Khamenei said.
CNN journalists in Tehran reported seeing long lines as voters apparently heeded calls for a big turnout.
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.
The street carnivals of Tehran's night hours over the past few days aimed to cruise the voters to the ballot boxes at 8:00 a.m. local time (0330 GMT) on May 19 to decide on their next president.
Rouhani's chief of staff Hamid Aboutalebi tweeted that Rouhani had won 60 percent of the vote.
Namazi's father is a veteran of the 1980s war between Iran and Iraq, and has fought for "the good of the country and the elevation of Islam".
"We must all respect the vote of the people", Raisi said as he cast his ballot in southern Tehran.
"I have stronger peace of mind and security, both socially and economically with Rouhani - we're not waking up in the morning to check the dollar rate every day like we used to", said 34-year-old Nastaran, a criminologist who asked to give only her first name. "Anyone who is elected must be helped from tomorrow with unity, happiness and joy".
Trump calls Russian Federation probe political 'witch hunt'
James Lankford, R-Okla., told reporters he still wanted Comey to testify before the Senate Intelligence Committee. "No, no. A special counsel has the freedom to look at anything they believe is relevant to their investigation.
However, that doesn't mean it will be easy.
Last year, Khamenei appointed Raisi as head of the Imam Reza charity foundation, which manages a vast conglomerate of businesses and endowments in Iran.
Raisi, who is believed to be one of several beaurocrats quietly groomed as a successor to 77-year-old Ayatollah Ali Khamenei, has been at the forefront of corruption and economic mismanagement claims against Rouhani.
Raisi has tried to gain support by promising more financial support to the working class and to triple cash handouts to the poor.
But Raisi's campaign was already complaining about the conduct of the election even before polls closed, saying there had been hundreds of "propaganda actions" by Rouhani supporters at voting booths, which are banned under election laws. "Rouhani gave everything to the U.S. outright" in the nuclear deal.
Raisi's election would be seen as a rebuke of the nuclear deal and, as Suzanne Maloney of the Brookings Institution told the Huffington Post, while the deal wouldn't fall apart immediately, it would "erode nearly inevitably as a result of the lack of commitment from Iran" under Raisi. He said that if the outcome of the elections does not match the candidate's wishes, "this should not disrupt the electoral process".
The two other candidates still in the race are Mostafa Hashemitaba, a reformist, and Mostafa Mirsalim, an ultra-conservative figure.
Most of the offences are related to the city and village councils elections, but there are also cases relating to the presidential polls too, he added.
After a regime change in Iran, following the 2015 elections, where Centrist-leaning President Hassan Rouhani was sworn into office, relations between Iran and US began to improve. That is nearly a prerequisite since every candidacy must be approved by the Guardian Council of the Revolution, made up of 12 legal consuls and religious scholars. He is subordinate to the country's supreme leader, who is chosen by a clerical panel and has the ultimate say over all matters of state. Rouhani also found himself surrounded by angry coal miners who beat and threw rocks at his armoured SUV during a visit to a northern mine struck by an explosion earlier this month that killed at least 42 people.
Wearing Rouhani's signature purple on ribbons and loosely draped headscarves, they honked, cheered and chanted slogans in support of Mir Hossein Mousavi, one of two Iranian opposition leaders under house arrest since 2011 who back Rouhani.
- Stock Jumping Abnormally High: Tanger Factory Outlet Centers Inc. (SKT)
- Trump willing to engage North Korea: Seoul
- Festival de Cannes : ça tourne
- Basquiat painting fetches record $110.5M at New York auction
- Star Wars Battlefront II: New Trailer Sheds Revealing Light on Protagonist
- Fractious House panel at centre of latest Trump probes
- QUALCOMM, Inc. (QCOM) Stock Rating Reaffirmed by Sanford C. Bernstein
- NAFTA critic calls Trump plans "markedly vague"
- Venezuelan students lead new protests
- Body dumped along Texas road after hearse stolen