Supporters of Gen Buhari celebrated as the results came in
Muhammadu Buhari has won Nigeria's presidential polls, in the country's first election victory by the opposition.
His party said his opponent, the incumbent President Goodluck Jonathan, admitted defeat and congratulated him.
Gen Buhari was ahead of Mr Jonathan by at least two million votes.
Observers have generally praised the election but there have been allegations of fraud, which some fear could lead to protests and violence.
However, a spokesman for Gen Buhari's All Progressives Congress (APC) party praised Mr Jonathan, saying: "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 spokesman added in quotes carried by Reuters.