Castillo, whose supporters include Peru’s poor and rural citizens, defeated right-wing politician Keiko Fujimori by just 44,000 votes.
Leftist school teacher Pedro Castillo, 51, is elected Peru's next president by an elections jury after reviewing claims of electoral fraud by his right-wing rival, Keiko Fujimori.
The rural teacher-turned-politician, whose supporters included Peru's poor and rural citizens, defeated right-wing politician on Monday Fujimori by just 44,000 votes.
Electoral authorities released the final official results more than a month after the runoff election took place in the South American nation.
Wielding a pencil the size of a cane, symbol of his Peru Libre party, Castillo popularized the phrase "no more poor in a rich country".
The economy of Peru, the world's second-largest copper producer, has been crushed by the coronavirus pandemic, increasing the poverty level to almost one-third of the population and eliminating the gains of a decade.
The shortfalls of Peru's public health services have contributed to the country's poor pandemic outcomes, leaving it with the highest global per capita death rate.
Castillo has promised to use the revenues from the mining sector to improve public services, including education and health, whose inadequacies were highlighted by the pandemic.
Fujimori, a former congresswoman, ran for a third time for president with the support of the business elites. She is the daughter of imprisoned former President Alberto Fujimori.
She said on Monday that she will accept Castillo's victory, after accusing him for a month of electoral fraud without offering any evidence.
The accusation delayed his appointment as president-elect as she asked electoral authorities to annul thousands of votes, many in Indigenous and poor communities in the Andes.
The president-elect has never held office. He worked as an elementary school teacher for the last 25 years in his native San Luis de Puna, a remote village in Cajamarca, a northern region.
The new president is due to be sworn in on July 28.