President Goodluck Jonathan handing over the national flags to President Buhari
The winner of Nigeria?s presidential election in March, Muhammadu Buhari, has been sworn in as leader of Africa?s most populous country.
Mr Buhari is the first opposition figure to win a presidential election in Nigeria since independence in 1960.
He has taken over from Goodluck Jonathan, who urged his successor to unite the country in the face of the threat from Boko Haram militants.
Mr Buhari, a former military ruler, says he is a convert to democracy.
He defeated Mr Jonathan ? who had been in office since 2010 ? by 15.4 million votes to 12.9 million.
The BBC?s Will Ross in the capital, Abuja, says heads of state and senior government officials have come from across the world to witness this truly historic moment for Nigeria.
In a country with a chequered history when it comes to power changing hands, this is a chance to celebrate deepening democracy, he says.
At the inauguration ceremony at Abuja?s Eagle Square ? Mr Jonathan handed over the constitution and national flags before Mr Buhari took his oath of office.
?I will discharge my duties to the best of my ability, faithfully and in accordance with the Constitution of the Federal Republic of Nigeria and the law,? he said to cheering crowds.
The announcer declared to the audience afterwards: ?Change has come to Nigeria.?
Among the guests at the ceremony is US Secretary of State John Kerry and African leaders including Zimbabwe?s President Robert Mugabe.
Mr Buhari comes into power as Nigeria faces significant economic as well as security challenges with an Islamist insurgency having devastated towns and villages in the north-east.
Besides tackling the Boko Haram militants, Mr Buhari has promised to stamp out corruption.