He was the only candidate nominated in parliament on Thursday so no vote was needed to make him president. MPs from the ruling African National Congress broke into song at the announcement.
In a speech to parliament Mr Ramaphosa, 65, said that corruption was on his radar.
The ANC had told Mr Zuma to step down or face a vote of no-confidence.
In a televised statement he said he was quitting with immediate effect but said he disagreed with his party’s decision.
Mr Zuma faces numerous corruption allegations but denies any wrongdoing.
One opposition party, the Economic Freedom Fighters, walked out of the parliamentary debate. It wants new elections, rather than the ANC deciding on the identity of the new president.