The ruling coalition led by Najib Abdul Razak, the Malaysian prime minister, wrested control of Perak state last February by convincing several Pakatan legislators to switch sides.
The decision to appoint Zambry was taken by the sultan of Perak, who is the titular head of the state.
The ensuing political crisis sparked public outrage and widespread allegations that the defectors had been bought over by Umno, the main party in the ruling coalition of which Najib is president.
|Zambry Abdul Kadir, centre, was declared the legitimate chief minister of Perak [Reuters]
Lim Kit Siang, a senior opposition leader, denounced Tuesday's verdict as a "black day for justice, a grave setback for democracy and a grievous blow to [the] restoration of confidence in the independence of the judiciary."
The row over who controlled Perak came after the opposition made unprecedented gains in Malaysia's 2008 general election, winning control of five of the country's 13 states.
The Pakatan alliance is led by Anwar Ibrahim, the parliamentary opposition leader and a former deputy prime minister, and currently on trial on charges of sodomising a male aide.
The federal court is the final legal avenue for the opposition to challenge the takeover. It can file for the federal court to review the verdict, but the court rarely reverses its own rulings.
Opposition leaders have disputed the legitimacy of the takeover and staged protests demanding fresh elections in Perak to let voters decide who should govern the state.
However Hamdi Abu Bakar, a Perak state legislator for the ruling coalition, urged Pakatan to accept the outcome and "come to the reality".
"If we respect democracy, if we respect the judiciary, we must respect the decision of the court," he said. "Why must we have fresh elections? We have the majority."