Although no date has been set for such a vote, Chief Justice Mogoeng Mogoeng said the National Assembly speaker had the authority to order a secret ballot following a case brought by the country's opposition.
Opposition parties have lobbied for a secret ballot and called for African National Congress (ANC) lawmakers to "vote with their conscience", but Speaker Baleka Mbete had in April said she had no powers to approve a secret ballot.
"You are trying to get a majority you don't have by saying 'secret ballot'," he told parliament.
"You can try, you can do everything, you can go to court but they will bring you back to the legislature."
More From This Section
The ANC holds a large majority in parliament and Zuma has survived several previous votes that were held in the open.
"We will defeat this motion of no confidence by the opposition as we have successfully done so in the previous four motions tabled in this fifth term of parliament," the ANC vowed in a statement released shortly after the court's decision.
The no-confidence vote was initially scheduled for April but delayed to allow the top court to rule.
James Selfe, chairman of the main opposition Democratic Alliance party, described the court's ruling as a "victory for the people of South Africa to remove a toxic president who is destroying our country".
The United Democratic Movement, which brought the case to court, said the ruling recognised the "seriousness" of the risk of ANC lawmakers being victimised if they vote to remove Zuma.
He is seen as favouring his ex-wife to succeed him, former African Union chief Nkosazana Dlamini-Zuma.
The ANC -- which Nelson Mandela led to power in the 1994 post-apartheid elections -- has lost popularity in recent years, taking just 55 per cent in last year's local elections, its worst-ever result.
In power since 2009, Zuma has been engulfed by graft scandals and has faced several humiliating court rulings while grappling with record unemployment and a sluggish economy, which is now in recession.
Zuma has been accused of being in the sway of the wealthy Indian Gupta business family, allegedly granting them influence over government appointments, contracts and state- owned businesses.
Thousands of leaked emails have recently emerged in the local press exposing alleged misconduct over lucrative government contracts awarded to the Guptas.
Last year the Constitutional Court found Zuma guilty of violating the constitution after he refused to repay taxpayers' money used to refurbish his private rural home.