The celebrity won his bid to be reinstated as a judge of the popular talent scouting show, Judge Caroline Nicholls ruled in the High Court in Johannesburg.
"This is a contractual dispute. The contractual relationship has to be reinstated to what it was. M-Net will pay costs to Gareth Cliff," Nicholls told a packed court.
Cliff, dressed smartly in a dark suit, smiled as the ruling, which lasted four minutes, was read out.
Earlier this week, the court heard an urgent court application by him to be reinstated as a judge on the reality singing competition. Cliff was booted from the M-Net show after he commented on KwaZulu-Natal realtor Penny Sparrow's Facebook post in which she called black people monkeys.
Cliff tweeted: "People really don’t understand free speech at all", creating consternation on social media and prompting M-Net to sack him, saying it did not want to be associated with a racist.
On Tuesday, however, his lawyer Dali Mpofu argued that his axing was the worst form of racism, while M-Net's Wim Trengove tried to convince the court that the broadcaster never had a contract with Cliff.
Cliff wanted his job back and R25 million for defamation and breach of contract.
Auditions for Idols 2016 will begin at The Playhouse in Durban on Saturday.