With returns in from 62 per cent of polling stations, Ortega had 38.59 per cent of the vote.
Sunday’s election in the Central American nation is the latest stage for the proxy war between Venezuela and the United States for regional influence.
Ortega battled US-backed Contra rebels for a decade before being voted out in 1990.
Encouraged by the early lead, thousands of Ortega’s Sandinista supporters set off fireworks and raced through the streets waving black-and-red party flags.
Senior party members hugged each other, some of them crying with joy, at a party in the capital Managua.
Montealegre, who was Washington’s favoured candidate, trailed on 30.94 per cent of the partial results.
Ortega needs 40 per cent of the votes or 35 per cent with a lead of at least five points over his closest rival to win outright and avoid a runoff.
Ortega has an advantage of almost 8 points over Montealegre.
He would almost certainly lose a runoff as Montealegre would pick up votes from Jose Rizo, the third-placed candidate.
Observers said the voting was generally calm, but there had been shouting matches at the end of the day as voters at some polling stations claimed the gates had closed while they were still waiting to cast their ballots.
Ortega’s supporters began to celebrate after voting ended
International monitors have been highly critical of what they termed “foreign meddling” in the campaign, and said that it could eventually backfire.
The US views Ortega as a dangerous leftist with close ties to Fidel Castro, Cuba’s president and Hugo Chavez, the Venezuelan president, and has said it could reconsider trade and aid if he is elected.
Calling Ortega “a tiger who has not changed his stripes,” Paul Trivelli, the US ambassador to Nicaragua, had urged Nicaraguans to defeat the former president and made it clear Washington favoured Montealegre.
Several US politicians have suggested blocking remittances from Nicaraguans living in the US, causing uproar in the country of 5.4 million people, where many rely on funds sent by US-based relatives.
Ortega’s opponents complain that Chavez effectively bought votes for Ortega by sending cheap Venezuelan fertiliser and fuel to Sandinista-affiliated groups.
Sandinistas counter that Washington has scared voters away from Ortega and is unfairly backing Montealegre.