"President Buhari died today in London at about 4.30pm, following a prolonged illness," President Bola Tinubu's spokesman said in a post on X.
Buhari, 82, who first led the country as a military ruler after a coup in the 1980s, earned a devoted following for his brand of anti-corruption conviction politics.
He referred to himself as a "converted democrat" and swapped his military uniform for kaftans and prayer caps.
"I belong to everybody and I belong to nobody," was a constant refrain Buhari told supporters and critics alike.
Buhari defeated Goodluck Jonathan in 2015 in what was judged to be Nigeria's fairest election to date.
Many hoped the retired major general would crack down on armed groups, just as he had as the country's military head of state.
Instead, violence that had mostly been confined to the northeast spread.
That left swathes of Nigeria outside the control of its stretched security forces as gunmen in the northwest, armed separatists and gangs in the southeast roamed unchecked.
Much of his appeal lay in the anti-corruption ethos that was a central plank of his agenda both as a military and civilian ruler.
He said endemic corruption in Nigeria's political culture was holding people back.
But Buhari quickly disappointed after his 2015 win.
He took six months to name his cabinet.
During that time, the oil-dependent economy was hobbled by low crude prices, prompting people to call him "Baba Go Slow".
His second victory in 2019 came despite his first term being blighted by Nigeria's first recession in a generation, militant attacks on oilfields and repeated hospital stays.
Buhari had been receiving medical treatment in London in recent weeks.
Born on December 17, 1942, in Daura in the northwestern state of Katsina state, Buhari enrolled in the army at 19.
He would eventually rise to the rank of major-general.
He seized power in 1983 as a military ruler, promising to revitalise a mismanaged country.
Buhari took a tough line on everything from the conditions sought by the International Monetary Fund to unruliness in bus queues.
In 1984, his administration attempted to kidnap a former minister and vocal critic living in the United Kingdom.
The plot failed when London airport officials opened the crate containing the abducted politician.
His first stint in power was short-lived.
He was removed after only 18 months by another military officer, Ibrahim Babangida.
Buhari spent much of the following 30 years in smaller political parties and trying to run for president until his eventual victory over Jonathan in 2015.
with AP