image copyrightGetty Imagesimage captionMr Castillo won the popular vote in elections last month, but was accused of voter fraud by right-wing rival Keiko Fujimori
Pedro Castillo has been declared president-elect of Peru, weeks after winning the popular vote in a tightly-contested run-off election.
The country's election authority announced its verdict after reviewing claims of electoral fraud by his right-wing rival, Keiko Fujimori.
Mr Castillo, a 51-year-old former school teacher and union leader, secured just over 50% of the votes.
He will now be sworn in as Peru's president on 28 July.
After the jury announced its verdict, Mr Castillo gave a speech in the capital, Lima.
"We are going to work together and bring this country together," said Mr Castillo, according to news outlet RPP. "We are going to reject anything that goes against democracy."
In a tweet, Peru's current President Francisco Sagasti said he welcomed the announcement.
"May this be the beginning of a new stage of reconciliation, consensus and unity," he added.
image copyrightGetty Imagesimage captionMs Fujimori said she would accept Mr Castillo's victory, despite her claims of election fraud
Mr Castillo burst onto the national scene four years ago when he led thousands of teachers on successful strike over pay.
During his presidential campaign, Mr Castillo pledged to nationalise Peru's lucrative mining and hydrocarbon sectors, and said he would aim to create a million new jobs in a year.
He also proposed re-introducing the death penalty to help tackle crime.
Mr Castillo won last month's election by a margin of only 44,000 votes – beating Ms Fujimori in her third bid for the presidency.
He has previously claimed victory, but a series of legal challenges by Ms Fujimori delayed an official verdict from election officials.
Ms Fujimori had provided little evidence of her claims of election, and Castillo's Free Peru party has rejected the accusations. Electoral observers, including the Organisation of American States, have also said they have found no irregularities.
Ahead of Monday night's announcement, Ms Fujimori said she would accept the result.
"The truth will come out anyway," she added. "We are all going to work together to re-establish legitimacy in our country."
Ms Fujimori is the daughter of former President Alberto Fujimori, who is in jail serving a 25-year sentence for crimes including corruption and human rights abuses.
Ms Fujimori herself is being investigated for alleged corruption and money laundering, claims she says are politically motivated. She spent a total of 13 months in jail between 2018 and 2020, when she was released on parole.
Her failure to become president means prosecutors can now proceed with the charges against her.
Ms Fujimori is accused of taking money from Brazilian construction giant Odebrecht to fund her failed presidential bids in 2011 and 2016. Prosecutors say they are seeking a 30-year jail term.