It was the first such vote on Zuma to be held by secret ballot, and dozens of members of his ruling African National Congress party revolted and supported the motion. Opposition parties hope it will encourage disgruntled legislators with the ruling African National Congress party to vote against Zuma.
President Jacob Zuma might have defeated yet another motion of no confidence in him, but opposition parties warned they will still see him in court.
A passage of the motion will force Zuma and his cabinet to resign, in which case ANC national chairperson and Parliament Speaker Baleka Mbete would assume the presidency for 30 days.
Mr Zuma is accused of corruption and mismanagement - charges he denies.
Shapiro feels South Africa has hard task ahead of turning the economy around - irrespective of today's outcome.
ANC MPs did a victory dance between the benches of the chamber moments before Mbete announced the official result, while Police Minister Fikile Mbalula broke the news to a large crowd of ANC supporters outside Parliament. Though falling short of the simple majority required to oust the president, the final tally of 177 votes to 198, with nine abstentions, was closer than many expected.
Mr. Zuma has already survived seven no-confidence votes.
The result of Tuesday's voting once again showed the unity of the ANC and the loyalty of ANC MPs to the organisation, an ANC MP said on condition of anonymity.
Zuma won the presidential election in 2009 and 2014, but has faced a number of no-confidence votes in the past due to accusations of corruption and mismanaging the economy.
Across the country, there were huge marches and protests as the elected leaders debated the issue of Zuma's removal.
"We are sure that the ANC has lost the confidence of the majority of South Africans". Against this background, the Rand seems destined to weaken further, particularly if worries over the central bank's independence grow and/or Moody's decides to follow its rivals by downgrading the country's credit rating to junk. Some party members have openly called for Zuma to step aside.
But ANC chief whip Jackson Mthembu said that at a meeting before the parliamentary session, the party had resolved to support him.