While markets welcomed the news as a sign of continuity in economic policy, Ramaphosa now faces the task of rebuilding support for the corruption-tainted ANC amid crippling power cuts that have hurt business and exacerbated rampant unemployment.
Ramaphosa's political future had been hanging by a thread earlier this month after a panel of experts issued a report saying preliminary evidence suggested he may have violated the constitution over a stash of foreign currency hidden in furniture at his game farm. He has denied any wrongdoing over the scandal, dubbed "Farmgate" by the media, and challenged the report in court. He has not been charged with any crime, but some opponents had called for his resignation.
At a party gathering in Johannesburg, Ramaphosa beat former health minister Zweli Mkhize by around 57% to 43% in a ballot to secure a second five-year term as ANC leader. Many of his allies also took many top seats in the party leadership.
Africa's most industrialised country holds its next general election in 2024. In municipal elections in 2021 the ANC won less than 50% of the vote for the first time since taking power at the end of white minority rule in 1994.
The announcement of Ramaphosa's victory on Monday was greeted with wild cheers in the conference hall from his supporters clad in ANC-branded tracksuits, T-shirts, caps and jackets in the party's black, green and gold colours.
Ramaphosa and Mkhize shook hands on stage after the results were announced, as delegates sang, danced and whistled to celebrate the result. Mkhize was health minister during the COVID-19 pandemic, until Ramaphosa put him on special leave last year over allegations that his department irregularly awarded contracts to a communications company controlled by his former associates. Mkhize has denied wrongdoing over the contracts.
In other ballots, ANC chairman Gwede Mantashe retained his position while Fikile Mbalula was elected secretary-general, the official in charge of the day-to-day running of the party. The ANC's "Top 7" group of highest officials is now more staunchly pro-Ramaphosa than the group that emerged from the 2017 conference where Ramaphosa won the top job for the first time.
Ramaphosa's only overt opponent in the Top 7 is first deputy secretary-general Nomvula Mokonyane. But her influence will be limited by the fact that the secretary-general and second deputy secretary-general are Ramaphosa backers.