Mohammed Mursiwon 51.73% of the vote, beating former PM Ahmed Shafiq, the Higher Presidential Election Commission said.
The head of the panel of judges, Farouq Sultan, said it had upheld some of the 466 complaints by the candidates, but that the election result still stood.
The announcement prompted scenes of jubilation in Cairo’s Tahrir Square, where Mohammed Mursi’s supporters gathered.
They have been maintaining a vigil there for days in protest at the series of decrees by the ruling Supreme Council of the Armed Forces (SCAF) which they say are designed to reduce or constrain the power of the president, and entrench the power of the military.
Supporters of Ahmed Shafiq had also been holding a rally in the capital’s northern suburb of Nasser City, home of the headquarters of the election commission.
Judge Farouq Sultan began the news conference by saying the declaration of the result had been “marred by tension and a bad atmosphere”.
“The commission applied the law when it looked into the ballots. There is nothing above the law,” he asserted.
The judge then dismissed what he said had been the two most serious complaints of electoral violations – that some ballots had been printed with the name of one candidate already ticked, and that Christians had been prevented from voting in a village in Minya governorate.
He then spent several minutes announcing minor amendments to the vote tallies before suddenly revealing that Mohammed Mursi had won 13,230,131 votes, compared with Ahmed Shafiq’s total of 12,347,380, or 48.27%.
The turnout in last weekend voting was 51.58%, he added.
As Judge Farouq Sultan announced the victory of Mohammed Mursi, who is chairman of the Muslim Brotherhood’s Freedom and Justice Party (FJP), huge cheers erupted in Tahrir Square.
Tens of thousands of his supporters, as well as those of ultra-conservative Salafist groups, had gathered there to listen to the result on big screens.
Many had camped out overnight to protest against what Islamists, secularists and youth activists have denounced as a military coup.
On 13 June, the justice ministry gave soldiers the right to arrest civilians for trial in military courts until the ratification of a new constitution.
The SCAF then issued a decree on Friday dissolving parliament in line with a Supreme Constitutional Court ruling that the law on elections to the lower house was invalid because party members had been allowed to contest seats reserved for independents.
Two days later, just as the polls were closing in the run-off, the generals issued an interim constitutional declaration that granted them legislative powers and reinforced their role in the drafting of a permanent constitution. The military was also exempted from civilian oversight.
Then on Monday, the head of the SCAF, Field Marshal Mohammed Hussein Tantawi, announced the re-establishment of a National Defence Council, putting the generals in charge of Egypt’s national security policy.
The generals have vowed to hand over power to the new president by 30 June, but their decision to dissolve parliament means he could take office without the oversight of a sitting legislature and without a permanent constitution to define his powers or duties.
At least 158 people have died in Spain's worst flooding disaster in generations. On October…
Google has been fined two undecillion (a two followed by 36 zeroes) roubles by a…
Embarking on a home remodel is an exciting journey, promising enhanced comfort, increased property value,…
The US presidential candidates continued to campaign across key swing states on October 20. Footage…
Elon Musk has said he will give away $1 million a day to a registered…
India and Canada have decided to expel their top envoys along with other diplomats as…