The government tried to convert Mackie Hill Primary School in Crigglestone into an academy, despite a wealth of opposition to the idea.
Parents, staff and local politicians all wanted the school to stay in partnership with nearby Kettlethorpe High, which is run by the council.
Campaigners have hailed people power for the result, which was confirmed by Mackie Hill on Twitter this weekend.
A positive recent Ofsted inspection prompted the government to rescind the academy order, which had been in place since 2018.
Catherine Holmes, the head of Mackie Hill's parent teacher association, said: "We're over the moon. It's two years of hard work that's come together.
"We did expect it the order to be rescinded after the Ofsted result came through, but we'd have fought it to the end anyway.
"I'm just delighted that all our hard work has paid off. We've got a fantastic head teacher, who's got a fantastic staff and we wanted that to remain in place.
"My youngest will be there for another five years now, and I'm very happy about that.
"Hopefully the school can settle down and blossom now."
The Inspire Partnership Trust, which runs eight local schools include the Ossett-based Gawthorpe Academy, had been put forward to take over Mackie Hill.
The sixth form providers behind New College Pontefract had been supposed to take over, but walked away from the deal last year after the backlash from parents.
In its tweet confirming the news on Saturday, said: "We’ve done it!
"We have received a letter from the Regional Schools Commissioner yesterday and we can confirm that the academy order for Mackie Hill has been revoked. Thank you to everyone who has supported us and helped us remain with the local authority."
In a statement, the Inspire Partnership's CEO said: "We would like to congratulate Mackie Hill on a very good Ofsted and wish them well for the future."
Local Democracy Reporting Service