Mr Buhari also praised outgoing President Goodluck Jonathan as a “worthy opponent” who peacefully relinquished power.
Gen Buhari beat Mr Jonathan by 15.4 million votes to 12.9 million.
Observers have generally praised the election, though there have been allegations of fraud.
Mr Buhari, of the All Progressives Congress (APC), has become the first opposition candidate to win a presidential election in Nigeria.
The former military ruler in a victory speech on Wednesday described his win as “historic”. He said that the vote had vindicated the people’s belief in democracy.
He also praised President Jonathan as “a worthy opponent” and said that he was extending “the hand of fellowship” to him.
This 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 although the 2011 vote was an improvement, most elections have been rigged or even annulled by the military.
Of course in a relatively close election, there will be millions of people who are not pleased with the outcome. But the whole process is a sign that democracy is deepening in Nigeria and may be a tonic to other countries in Africa.
Nigerians can start to believe that it is possible to remove politicians through the ballot box.
Mr Buhari told his supporters at APC headquarters: “We have proven to the world that we are people who have embraced democracy. We have put the one-party state behind us.”
“You, Nigerians, have won. The people have shown their love for this nation and their belief in democracy.”
On Tuesday, Mr Jonathan said in a statement: “I promised the country free and fair elections. I have kept my word.”
Muslim from northern Nigeria, aged 72 Military ruler of Nigeria from 1984 to 1985, deposed in a coup Seen as incorruptible Poor human rights record.
Disciplinarian – civil servants late for work had to do frog jumps Survived apparent Boko Haram assassination attempt.
The outgoing leader urged his supporters to stay calm: “Nobody’s ambition is worth the blood of any Nigerian. The unity, stability and progress of our dear country is more important than anything else.”
He said he had conveyed his “best wishes” to Mr Buhari, and urged “those who may feel aggrieved to follow due process… in seeking redress”.
However, analysts say the margin of victory is likely to prevent any successful legal challenge.
His spokesman Reuben Abati told BBC World News he did not know what Mr Jonathan would do after he hands over power on 29 May.
This election was the fourth time that Gen Buhari, 72, had contested presidential elections.
He gained much of his support in the north, in particular the north-east, which has suffered from Boko Haram’s six-year insurgency.
It has killed thousands of people in its drive to establish an Islamic state.
Many people accused Mr Jonathan of not taking Boko Haram seriously and thought Gen Buhari would be better positioned to defeat the militants.
The election was delayed by six weeks to allow the army enough time to recapture territory from Boko Haram.
The former military ruler won 94% of the vote in the worst affected state, Borno.