Mr Aleman, 50-year-old leader of the Liberal Alliance coalition, won 48.5 per cent of the vote to Mr Ortega's 39 per cent, according to incomplete official results.
But even as the former United States President Jimmy Carter was saying that the elections had been free and fair, Mr Ortega, 50, summoned reporters to Sandinista headquarters to dispute the result.
Looking stunned, standing with his wife behind him, Mr Ortega called for a recount in some areas. "Annul the vote. Viva Daniel," shouted about 100 hardline supporters who suddenly appeared behind the media representatives.
"Unlike in 1990 [when he was defeated by conservative Violeta Chamorro], at this moment we cannot accept the result," he said. "There were several anomalies. In Matagalpa, comparing the official results with our parallel count, we found 60,000 votes missing out of 300,000.
"We will continue fighting for the poor until the end," he concluded, to the cheers of his supporters. His remarks raised tension here after a voting day which had passed peacefully and was widely seen as a sign of Nicaragua's increasing political maturity.
Politically, the defeat could mean the end of the Sandinista National Liberation Front (FSLN), at least in its present form. Mr Ortega had already moved towards the centre during the campaign. Some analysts said that in refusing to accept the result, the Sandinista leader, soundly beaten for the second straight time, was playing the only card he had left - the ability to disrupt the government by keeping his supporters in a state of revolt.
That could lead to a new polarisation in Nicaragua, particularly if, as many here claim, Mr Aleman proves to be something of an admirer of the former dictator Anastasio Somoza.
Mr Aleman rejected Mr Ortega's claim and called him a bad loser. Even some moderate Sandinistas agreed, expressing embarrassment at the FSLN leader's stance at what has been seen by most Nicaraguans as a time of reconciliation.
The party that came a distant third in the presidential race, the Nicaraguan Christian Path (CCN), also claimed fraud and called for a totally new election. Mr Carter, however, heading an observer delegation from his Carter Centre in Atlanta and a European Union mission of observers, dismissed the existence of any significant fraud.
Mr Aleman's coalition was a reshuffled version of the United Nicaraguan Opposition (UNO), which Mrs Chamorro led successfully in 1990. She was widely criticised during her tenure for failing to create jobs, economic growth and security.
Many Nicaraguans blamed continuing Sandinista influence in key positions, notably the army and the bureaucracy, for her perceived weak leadership.
Mr Aleman, whose wife died of cancer in the late Eighties, has promised to create 100,000 jobs in his first year. From a well-off coffee-farming family, he had his property confiscated by the Sandinistas and spent six months in jail after someone accused him of being "counter- revolutionary". He has denied being a follower of Somoza, ousted by the Sandinista revolution in 1979 and assassinated in exile a year later, but is said to have belonged to a pro-Somoza youth movement.
He has, however, admitted that he would like to recreate a baseball team called the Five Stars, which was renowned under Somoza but broke up during the revolution.