Opposition councillors on Cardiff Council have defeated the controlling Liberal Democrats' plans to reorganise city schools.
There have been angry protests against the closure plans
After a three hour debate, councillors voted by 38 to 28 to reject proposals which would have led to the closure of 17 secondary and primary schools.
Demonstrations by parents and pupils have been held against the plans.
The proposals, to deal with 8,600 spare places costing £3m a year, have been backed by the Wales Audit Office.
An audit office report issued to the council this month had said the current schools setup was "an inefficient use of education resources and reduces the money available to be spent on improving teaching and learning".
It concluded the local authority had "rightly" decided it needed to consult on the proposed overhaul and had examined the situation with "fairness and accuracy".
Before Thursday's meeting, council leader Rodney Berman said the audit office report had vindicated his administration's position.
But opposition parties, which hold 43 of the 75 seats on the council, said they would combine to defeat the minority Lib Dem administration over the school plans.