Lawmakers voted to reject a report by a panel of experts that found preliminary evidence Ramaphosa may have committed misconduct over a stash of foreign currency hidden at his private game farm.
His ruling African National Congress (ANC) party defeated the motion by 214 votes to 148, with two abstentions through open voting.
Lawmakers during the extraordinary parliamentary session voted after debating the findings of an independent panel which said Ramaphosa may be guilty of serious violations and misconduct over allegations he concealed a huge cash theft at his farm.
The vote prevented an impeachment procedure that was feared could have politically destabilised Africa's most industrialised country.
Ramaphosa -- championed as a graft-busting saviour after corruption-stained predecessor Jacob Zuma -- survived thanks to the support of a majority of ANC MPs.
The 70-year-old president had last week secured the backing of the ANC, which holds 230 of the National Assembly's 400 seats, after mounting a legal bid to have the damning report annulled.
Ramaphosa's escape comes just days ahead of a crucial ANC meeting to elect the new leadership.
Although the ANC's national executive had vowed last week to shoot down any attempt to force Ramaphosa from office, his continued stay in office remains to be seen after the conference.
His "leadership will be tested again at the party's national conference", Aleix Montana, analyst at risk intelligence firm Verisk Maplecroft, said in a note.
He will likely be re-elected as leader because "there is no viable alternative candidate in the ANC that can secure the political survival of the party," said Montana.
That will position him for a second term as head of state, if the ANC wins the 2024 national election.
Last week's ANC decision to back Ramaphosa upset some in the party.
A few ANC lawmakers, including Nkosazana Dlamini-Zuma -- Ramaphosa's rival, a cabinet minister and Zuma's ex-wife -- defied the party command.
She walked out of parliament telling journalists that if Ramaphosa wants to fire her, "it's his democratic right. I won't hold it against him."
Ramaphosa has denied wrongdoing over the scandal, which had been named "Farmgate" by the media. He has challenged the report in court and not been charged with any crime, but some opponents have called for his resignation.
Justice Minister Ronald Lamola trashed the report saying "there is not sufficient evidence to impeach the president."
Opposition parties presented a largely united front on the scandal.
"Today South Africans were left in no doubt that the presidency of... Ramaphosa is no different to the presidency of... Zuma," said John Steenhuisen, leader of the largest opposition Democratic Alliance, accusing both of weakening parliament "to evade scrutiny and the law".
Julius Malema, the fiery leader of the second largest opposition Economic Freedom Fighters party, expressed "deepest disappointment" in Ramaphosa who was once a "celebrated... architect" of South Africa's constitution.
He said Ramaphosa was now "peeing" on that document, calling him a "constitutional delinquent".
This report was prepared with data from Reuters and Agence France-Presse.