Bola Tinubu of the All Progressives Congress, center, celebrates with supporters at the party's campaign headquarters after winning the presidential elections in Abuja, Nigeria, Wednesday, March 1, 2023. [AP]

Ruling party candidate Bola Tinubu was declared winner of Nigeria's presidential election early Wednesday, with the two leading opposition candidates already demanding a revote in Africa's most populous nation.

Election officials' overnight announcement was likely to lead to a court challenge by his main opponents Atiku Abubakar and Peter Obi. Abubakar also finished second in the last vote in 2019, then appealed those results before his lawsuit ultimately was dismissed.

On Tuesday, the two leading opposition parties demanded a revote, saying that delays in uploading election results had made room for irregularities. The ruling All Progressives Congress party urged the opposition to accept defeat and not cause trouble.

Tinubu received 37% of the vote, or nearly 8.8 million, while the main opposition candidate Abubakar won 29% with almost 7 million. Third-place finisher Obi took 25% with about 6.1 million, according to the results announced on live television by the Independent National Electoral Commission.

Tinubu "having satisfied the requirements of the law, is hereby declared the winner and is returned elected," said the country's election chief, Mahmood Yakubu.

The announcement came after 4 a.m., but celebrations already had started late Tuesday at the ruling party's national secretariat where Tinubu's supporters had gathered in anticipation of his victory.

"None of the others matches his record!" said Babafemi Akin as he chatted excitedly about the prospects of a Tinubu administration. "I am sure he will do well."

Supporters of Presidential candidate Bola Tinubu of the All Progressives Congress celebrate the victory of their candidate in the presidential elections at the Party's campaign headquarters in Abuja, Nigeria, Wednesday, March 1, 2023. [AP]

Tinubu, 70, is the former governor of Lagos state, home to Nigeria's megacity of the same name. However, he lost the state in Saturday's election to Obi, who drew a strong following among younger voters eager for change.

The parties now have three weeks to appeal results, but an election can be invalidated only if it's proven the national electoral body largely didn't follow the law and acted in ways that could have changed the result.

The Supreme Court of Nigeria has never overturned a presidential election, though court challenges are common, including by outgoing President Muhammadu Buhari, who doggedly fought his past election losses for months in vain.

Nigeria's presidential election has been closely watched as the country is not only the continent's largest economy but it is also one of the continent's top oil producers.

Observers have said Saturday's election was mostly peaceful, though delays caused some voters to wait until the following day to cast their ballots. Many Nigerians had difficulties getting to their polling stations because of a currency redesign that resulted in a shortage of bank notes.