A motion of no-confidence in Zuma was defeated by 198 votes to 177. Even though the ballot was held in secret, the opposition was not able to persuade enough members of Zuma's ruling African National Congress to side with them.
Members of the ANC sang in celebration even before the result was formally announced.
"I would like to thank you very much," Zuma told supporters. "Once again, we prove that the ANC is the organization of the people."
As head of the party that led South Africa out of apartheid, Zuma won the presidential election in 2009 and 2014, but has been dogged by criminal investigations and corruption allegations. Dubbed the "Teflon" president, he has survived a half dozen no-confidence votes.
The latest vote was organized by the opposition Democratic Alliance party. "The choice before us is a simple one. Either we allow one family, aided and abetted by the President to take everything from us or on behalf of the people of South Africa we take our country back," opposition leader Mmusi Maimane said in an emotional speech that opened the debate on the motion Tuesday.
Doris Dlakude, deputy chief whip of the ANC in the National Assembly, had urged her members to support Zuma. "This debate is about our integrity as the governing party," she said.
She claimed the motion of no confidence was the work of an "insurrectionist opposition" whose main aim was to "sow seeds of chaos in society to ultimately grab power."
Zuma, 75, has been mired in controversy for years. In 2016, South Africa's top court ruled that Zuma had acted unconstitutionally
when he used $15 million in public funds to upgrade his private home, and ordered him to repay some of the money.
Zuma, a polygamist and father of more than 20 children, also faces more than 783 allegations of corruption
relating to a 1990s arms deal.
He denies all the corruption allegations against him. And despite street protests, opposition maneuvering
, and defections from his own party, he has always refused to step down voluntarily.
ANC politicians are already looking to a future without Zuma, whose term ends in 2019. The party will meet in December to choose his successor. Many in the ANC would rather dictate their own future than be forced by opposition groups.
But several powerful ANC members, such as former Finance Minister Pravin Gordhan -- who was controversially sacked by Zuma
earlier this year -- deserted him and had urged MPs to vote with their conscience.
This story has been updated to correct the year that the Constitutional Court ordered Zuma to repay public funds over house improvements, and the amount he was ordered to pay.