An Ofsted inspection judgment that would have put a state school into special measures has been quashed by the High Court.
Judges ruled the inspectorate's complaints process was unfair, stating that Durand Academy, a south London primary school, was unable to effectively challenge the report on its performance.
In a statement, Durand's chairman of the board of governors, Sir Greg Martin said the report would have "destroyed" the school.
Ofsted said it intends to appeal against the ruling.
In his judgment, Judge McKenna said: "To my mind, a complaints process which effectively says there is no need to permit an aggrieved party to pursue a substantive challenge to the conclusions of a report it considers to be defective because the decision maker's processes are so effective that the decision will always in effect be unimpeachable is not a rational or fair process."
He added: "The absence of any ability effectively to challenge the report renders the complaints procedures unfair and, in my judgment, vitiates the report."
Sir Greg said: "This report would have destroyed this school when it should have been held up as a beacon for what other inner city schools should be."
"This year's school results have been exemplary and have placed us in the top 2.1% of primary schools in the country and yet Ofsted judged our school to be failing and wanted to sack the headteacher and the board of governors."
He added: "It has taken us six months and around £300,000 to fight this unfair school report through the courts, and when you include Ofsted's legal bill the amount of money wasted on this action is in excess of £500,000.
"The money to pay for the legal action has come from revenue from the school and thankfully because we have won the case we should be able to claw back a large proportion of our legal costs."
An Ofsted spokeswoman said: "We are clearly disappointed in this ruling and have sought permission to appeal.
"Notwithstanding the overall judgment, we are pleased that the court recognised the impartiality and professionalism of the inspectors undertaking the inspection.
"Our complaints process is longstanding and has previously been commended by the independent adjudicator.
"However, as an organisation we always keep policies and practices under review and regardless of the outcome of the appeal application will consider whether any clarification of our complaints procedure may be required."
Judge McKenna noted in his ruling that Durand Academy has undergone significant expansion in recent years, including a new site and offering boarding facilities and that there were "stark differences" between the views on the school and Ofsted on how the inspection was conducted and what was found.
It also recorded that the school has an ongoing dispute with the Education Funding Agency (EFA) which announced in June that it intends to terminate Durand's academy funding agreement, a move which would come in at the end of next academic year (2017/18).