The former military ruler, 76, is seeking re-election at polls on February 16, against a backdrop of mounting concern about vote-buying and violence.
Chief Justice Walter Onnoghen, who heads the Supreme Court, would rule on any legal challenge to the result.
But on January 12 he was slapped with a six count charge relating to the non-disclosure of foreign currency bank accounts, in breach of rules for public officials.
The judge on Thursday secured an injunction ordering the Code of Conduct Tribunal hearing his case to halt proceedings pending his application to have the charges dropped.
But Buhari instead ordered his suspension and indicated he was forced to act because Onnoghen had not stepped down voluntarily himself.
The case was a distraction, he said, but added it was "no secret that this government is dissatisfied with the alarming rate" of acquittals in corruption cases under Onnoghen.
Buhari, who was elected in 2015 on a pledge to stamp out corruption, swore in judge Ibrahim Tanko Muhammad as acting chief justice at a ceremony at his official residence.
'Dictatorial act'
The initial charges against Onnoghen, reportedly made by a former spokesman for Buhari, and the speed with which he was brought to court has dominated headlines in Nigeria for days.
On Friday, his main challenger, Atiku Abubakar, of the Peoples Democratic Party, called the suspension a "brazen dictatorial act".
It was "the latest action in the ongoing rape of our nation's hard-earned democracy by those who dined with anti-democratic forces", he said in a clear reference to Buhari's army past.
Buhari seized power in December 1983 by overthrowing civilian president Shehu Shagari, ruling with an iron fist until he was ousted by general Ibrahim Babangida in August 1985.
He has since acknowledged he cannot change the past, calling himself a "converted democrat" but has struggled to shake off his autocratic reputation.
Abubakar, a former vice-president, said the suspension of Onnoghen was "symptomatic of the increasing desperation" of his rival to cling on to power.
The Coalition of United Political Parties, an opposition grouping supporting Abubakar, meanwhile called it "a judicial coup that must be resisted by all lovers of democracy".
"Buhari has finally overthrown constitutional governance. This factionalisation of the judiciary will not stand," it added in a statement.
Under Nigeria's constitution, a chief justice can be removed only if he is convicted of an offendce or if the Senate upholds a presidential request to do so by a two-thirds majority.
"Onnoghen's illegal removal was aimed at stopping the swearing in of members of the 2019 general election petition tribunal," said CUPP spokesman Ikegna Imo Ugochinyere.
Buhari said he was acting on the recommendation of the Code of Conduct Tribunal.
Abubakar questioned why due process was not allowed to run its course and called for the international community to threaten "strong consequences" for anyone involved.
The United States and Britain have said anyone involved in vote-rigging or election violence would be denied visas.
Appointment delay
Both the PDP and Buhari's ruling All Progressives Congress (APC) were accused of vote-buying in recent governorship elections.
Cheta Nwanze, an analyst with Lagos-based SBM Intelligence, told AFP the Onnoghen case was "a clear indication they (the APC) are panicking" about the results.
Buhari initially delayed the appointment of Onnoghen, after he became acting chief justice in November 2016.
His appointment was only confirmed by parliament in March 2017, prompting speculation Buhari was not keen to endorse his candidacy.
Onnoghen has since criticised what he said was the politicisation of judicial appointments in Nigeria and cleared Senate leader Bukola Saraki on corruption charges.
Saraki has accused the government of targeting him because he was not its first choice as leader of the upper house of parliament.
Buhari has been accused of surrounding himself with ministers, advisors and officials from the predominantly Muslim north, his home region.
Onnoghen is from Cross Rivers state in the Christian-majority south, while Muhammad is from the northeastern state of Bauchi.