The verdict is the culmination of two months of arguments in a case that has become a rallying point for Musharraf's political opponents.
The court today reinstated Chief Justice Iftikhar Mohammad Chaudhry and quashed the misconduct charges that were filed against him by Musharraf.
The presiding judge in the case, Khalil-ur-Rehman Ramday, ruled that Musharraf's order suspending Chaudhry on March 9 was "set aside as being illegal."
Analysts say the verdict is a major blow to Musharraf's standing and probably the biggest challenge to his dominance since he seized power in a bloodless coup in 1999.
It also could further complicate Musharraf's bid to win a new five-year presidential term through elections this fall.
Absar Alam, the Islamabad bureau chief for Pakistan's private GEO TV channel, says the ruling is "quite a big blow" to Musharraf and his authority, as well as his credibility.
"Musharraf himself has said that he will respect whatever the court says," Alam says. "So we will see what happens because there was a high-level meeting going on at the president's house [when the decision was announced]. The chief ministers and governors of various provinces were there. They were actually discussing the aftermath of the Supreme Court verdict. So we'll see what surprise they come up with."
Suspension Provoked Protests
Pakistani Prime Minister Shaukat Aziz said after the ruling that the government accepts the court's decision and that "the constitution and the law have prevailed."
Supporters of Chaudhry at the Supreme Court in April (epa)
Aziz also said it is not time for any side in the dispute to claim victory or defeat.
Chaudhry's suspension sparked protests by lawyers and opposition parties that sometimes turned violent. Those protests have grown into a powerful pro-democracy movement just as Musharraf faces a rising tide of Islamic militancy.
Speaking in Lahore on July 14, Chaudhry told a rally of lawyers and supporters that Pakistan's judiciary must be able to act independently and without interference from the executive branch of government:
As lawyers celebrated outside the court in Islamabad today, Chaudhry's chief counsel Aitzaz Ahsan told reporters that the case is "a victory for the entire nation."
(Ayesha Khan contributed to this story)