The 76-year old leader, in power since 2015 and re-elected in February, took the oath of office for a second four-year term in the capital Abuja.
“I do solemnly swear that I will be faithful and bear true allegiance to the Federal Republic of Nigeria,” Buhari said, dressed in simple white robes and traditional embroidered cap. “I will preserve, protect and defend the constitution.”
Buhari took the oath of office at what officials called a “low-key” ceremony.
It included a red-carpet arrival flanked by bagpipers with a military guard of honour and seating packed with dignitaries.
Vice President Yemi Osinbajo was also sworn into office.
Buhari was re-elected with 56 percent of the vote in Africa’s most-populous nation — and top oil producer — after a delayed poll that angered voters.
His rival, Atiku Abubakar of the Peoples Democratic Party (PDP), who came second with 41 per cent of the vote, has along with other opposition leaders launched an ongoing legal challenge to the victory.
They allege irregularities in the vote and have called it a “sham” result.
Buhari, a former army general who led a tough military government in the 1980s, campaigned on a promise to make the country safer.
He begins a final term beset with numerous challenges.
On Tuesday night, a large force of the Boko Haram militants attacked the northeastern city of Maidugari, but soldiers stopped them before they could enter, resulting in a night-long battle, according to security sources.
The fighters fled just before dawn on Wednesday, they said.
Buhari, who inspected the military parade in front of applauding spectators after watching the flag of Nigeria raised to the national anthem, made no speech. “My frustration is that we cannot move faster in prosecution and punishment of corrupt persons,” Buhari said late Monday.
“Even if you are using whistle blowers, you have to go to the police to go through the rigmarole of full investigation before prosecution,” he added.