Castillo, an elementary school teacher raised in an impoverished village, was leading the count by 51,000 votes on Saturday morning, when only around 62,000 votes remained to be counted.
"We won, teacher Pedro Castillo (is) President," tweeted his party, Free Peru, late on Friday.
Fujimori, the daughter of jailed ex-President Alberto Fujimori, has doubled down this week on unsubstantiated allegations of fraud, seeking to disqualify tens of thousands of votes.
But even if Fujimori were to succeed, the number of votes still in play make it unlikely she would succeed in flipping the result.
The tense vote count is the culmination of a bitterly divisive election in Peru, where low-income citizens supported Castillo while wealthier ones voted for Fujimori.
On Saturday, Peru's electoral jury tried to push back a deadline to allow Fujimori to submit requests to disqualify up to 200,000 votes cast in Peru's poorest regions, but said in the afternoon that it had backtracked that plan, paving the way for a Castillo victory. In the end, Fujimori has only been able to challenge some 38,000 votes.
"We call for the (electoral jury) to guarantee and support a clean and just electoral process," Castillo tweeted on Friday night. "The Peruvian people deserve it."
Fujimori, meanwhile, responded on Twitter that "the field was not level." She has so far declined to concede.
Fujimori first brought up allegations of fraud on Monday, and doubled down on Wednesday when she signaled she intended to seek the annulment of some 200,000 votes in rural areas of the country that support Castillo.
One of the her main arguments is that she had won no votes among voter groups in those regions that pool up to 300 people, which she said was a sign of fraudulent action.
Left-wing Castillo has spooked markets, largely because his party, Free Peru, is self-described as Marxist-Leninist.
Castillo has recently sought to appease markets with a moderate-left platform, but it remains unclear if his administration will ultimately keep that tone or revert to the party's roots as a far-left organization.