Muhammadu Buhari's has been declared the winner of the Nigerian election, beating Goodluck Jonathan(Getty)

Nigeria's Muhammadu Buhari has been officially declared the winner of the country's presidential poll.

Buhari's All Progressives Congress (APC) party was revealed to have won the election after Goodluck Jonathan, leader of the sitting People's Democratic Party, called the former military leader to concede defeat.

Buhari is said to have won the closely fought election by around two million votes. The win means an opposition has been voted into power for the first time in Nigeria's history.

APC spokesman Lai Mohammed said: "At about five minutes to five, President Jonathan called General Muhammadu Buhari, the winner of the elections, to congratulate him.

"I think he conceded defeat. There had always been this fear that he might not want to concede but he will remain a hero for this move. The tension will go down dramatically..

"Anyone who tries to foment trouble on the account that they have lost the election will be doing so purely on his own."

The election, described as the tightest presidential race ever in the 54-year post-independence history of the Western African nation, has taken on more significance since the insurgence of the Islamic group Boko Haram in the country.

After 35 of the 35 states declared, initial results suggest Buhari had attracted 14.9 million votes compared to Jonathan's 12.8 million.

Following the result, Buhari's wife and Nigeria's new First Lady Aisha Buhari described the result as proof Nigerians are "aware now more than ever that the people have the power to sway the fate of a nation".

Buhari's first claim to power was as a military junta that ruled Nigeria for almost two years in the 1980s until he was ousted and jailed. This 2015 election campaign was the fourth time he attempted to run for president in Nigeria.

This is only the eighth time Nigeria has held an election since it won independence from Britain in 1960 because of decades of military dictatorship and the fifth poll since democracy was restored in 1999.

People react as partial results of the Nigerian presidential elections are released indicating Muhammadu Buhari is ahead(Getty)