Former military ruler, Muhammadu Buhari, made history after defeating the incumbent, Goodluck Jonathan, to become the first opposition candidate to win a presidential election in Nigeria.
According to the BBC, Buhari won by a margin of about two million votes.
The former military ruler managed to win more than 25% of votes in 24 states, meaning he avoided the possibility of a run-off with Mr Jonathan.
He dominated the country’s north-western states, which have suffered most from attacks by Islamist militant group Boko Haram.
In Borno state, one of the worst-affected by Islamist violence, Gen Buhari won 94% of the vote.
It is the fourth time that Gen Buhari, 72, has sought the presidency.
He ruled Nigeria from January 1984 until August 1985, taking charge after a military coup in December 1983.
Goodluck had led Nigeria since 2010, initially as acting leader before winning elections in 2011.
Nigeria has suffered from several attacks by the Islamist militant group Boko Haram, which has killed thousands of people in its drive to establish an Islamic state.
Goodluck has already conceded defeat and telephoned Gen Buhari, 72, to congratulate him and concede defeat.
“I promised the country free and fair elections. I have kept my word,” Jonathan said in a statement.
He said he had conveyed his “best wishes” to Buhari, and urged “those who may feel aggrieved to follow due process… in seeking redress”.
A spokesman for Gen Buhari’s All Progressives Congress (APC) party praised Jonathan, saying: “He will remain a hero for this move. The tension will go down dramatically.”
Gen Buhari’s supporters took to the streets in APC strongholds, including the northern cities of Kano and Kaduna, to sing and dance in celebration.
Gen Buhari’s victory is a hugely significant moment in Nigeria’s turbulent history.
Never before has a sitting president been defeated in an election.
Since independence from Britain in 1960, there have been numerous coups and most elections have been rigged.
The APC issued a statement after the result was announced, calling for “calm, sober celebrations” and warning supporters not to attack opponents.
“He or she is not with me, whoever does that,” the new president said.