The constitutional court said that the Speaker of parliament had the right to order such a move. She had previously stated she did not have the power.
Opposition parties believe that under a secret ballot, MPs from Mr Zuma's ANC party would vote against him.
He has survived several previous votes of no-confidence.
Mr Zuma has been under constant pressure over everything from corruption allegations to a controversial cabinet reshuffle that saw his widely respected finance minister fired.
Delivering his verdict, Chief Justice Mgoeng Mgoeng said that under South Africa's separation of powers, it was up to the Speaker of parliament to decide how the vote was conducted.
The speaker, Baleka Mbete, is a top ANC official and had argued that the rules of parliament did not allow for a secret ballot.
Zuma likely to survive, by Milton Nkosi, BBC News, Johannesburg
This decision certainly puts more pressure on President Zuma. But it does not seal his fate.
The ball is back in Baleka Mbete's court. As the Speaker of the national assembly, she has been President Zuma's protector-in-chief in parliament.
A secret ballot is now very likely. The judges effectively told her to hold one and we know from her court submission that she was "not against" it.
But it is still highly unlikely that ANC MPs will vote President Zuma out of power by supporting a vote of no-confidence, particularly one brought by the opposition.
They will use their majority to keep him in office. Mr Zuma's fate, however, will be sealed back at the ranch, when the ANC meets in December to vote in a new presidential candidate. They might just reject his preferred candidate for the 2019 election.
Responding to the ruling, the ANC said it would defeat the motion to remove Mr Zuma, which the opposition Democratic Alliance said presented an opportunity to oust a "toxic" president.
A new date for a motion of no-confidence now has to be set.
On top of the confidence votes, President Zuma has lost a number of prominent court cases against him, including one which ended with him being ordered to pay back a portion of state funds used to refurbish his private home in Nkandla.
But it was the reshuffle that proved particularly damaging, with Mr Zuma facing calls from within his own party to resign.