With some 90% of the 28.6 million ballots counted, Raisi's tally was 17.8 million, interior ministry official Jamal Orfi said, giving him an unassailable lead.
Turnout in Friday's four-man race was a record low of around 48%.
Appointed by Supreme Leader Ayatollah Ali Khamenei to the high-profile job of judiciary chief in 2019, Raisi was placed under U.S. sanctions a few months later over human rights violations.
Those included the role that human rights group say Raisi played in the executions of thousands of political prisoners in the 1988 and in the violent suppression of unrest in 2009.
Iran has never acknowledged the mass executions, and Raisi himself has never publicly addressed allegations about his role.
Seen by analysts and insiders as representing the security establishment at its most fearsome, Raisi had been widely tipped to win the contest, thanks to Khamenei's endorsement.
Amnesty International’s Secretary General Agnès Callamard said Raisi's election win was "a grim reminder that impunity reigns supreme in Iran." "We continue to call for Ebrahim Raisi to be investigated for his involvement in past and ongoing crimes under international law, including by states that exercise universal jurisdiction," she said in a statement.
Outgoing pragmatist President Hassan Rouhani visited Raisi at his office to congratulate him, and Foreign Minister Mohammad Javad Zarif said he would lead Iran well.
"We will stand by and cooperate fully with the president-elect for the next 45 days, when the new government takes charge," state media quoted Rouhani as saying.
NUCLEAR TALKS
Raisi's election comes at a critical time.
Iran and six major powers are in talks to revive their 2015 nuclear deal. Then U.S. President Donald Trump abandoned the deal in 2018 and reimposed crippling sanctions that have squeezed Iran's oil income.
With Iran's ruling clerics aware their political fortunes rely on tackling worsening economic hardships, Raisi's win will not disrupt Iran's effort to revive the pact and break free of tough U.S. oil and financial sanctions.
Khamenei, not the president, has the last say on all issue of state such as Iran's foreign and nuclear policies.
"We will make every effort in the new government to solve the problem of people’s livelihoods," Raisi said, according to state media.
Seeking to win over voters preoccupied by bread-and-butter issues, Raisi has promised to create millions of jobs and tackle inflation, without offering a detailed political or economic program.
LACK OF CHOICE
Hoping to boost their legitimacy, the country's clerical rulers had urged people to turn out and vote on Friday, but simmering anger over economic hardships and curbs on freedoms kept many Iranians at home.
Hundreds of dissidents, at home and abroad, had called for a boycott. However, Khamenei said the turnout displayed the clerical establishment's popularity.
Another deterrent for many pro-reform voters was a lack of choice, after a hardline election body barred heavyweight moderates and conservatives from standing.
A U.S. State Department spokesperson said on Friday: "Iranians were denied their right to choose their own leaders in a free and fair electoral process" - a likely reference to the disqualification of candidates.
Many pro-reform Iranians fear Raisi's presidency could usher in more repression.
"I am scared. I don't want to go back to jail again. I am certain that any kind of dissent will not be tolerated," said Hamidreza, who declined to give his full name. He was jailed for participating in unrest in 2019 that broke out over fuel price hikes and quickly turned political.
Analysts say the election win could increase Raisi's chances of succeeding Khamenei, who himself served two terms as president before becoming supreme leader in 1989.