South African deputy president Cyril Ramaphosa has been elected as leader of the ruling African National Congress party, winning a bruising race that exposed deep rifts within the organisation that led the struggle against apartheid.
As ANC leader, Mr Ramaphosa, a 65-year-old union leader who became a businessman and is now one of South Africa's richest people, is likely to become the country's next president after elections in 2019.
He has promised to fight rampant corruption and revitalise the economy, a message hailed by foreign investors.
Jacob Zuma's presidency, tainted by corruption and scandal, has badly tarnished the ANC's image both at home and abroad.
The party once led by Nelson Mandela is now deeply divided.
Mr Ramaphosa narrowly beat Nkosazana Dlamini-Zuma, 68, a former cabinet minister and Mr Zuma's ex-wife, in the vote, marking a pivotal moment for the ANC which launched black-majority rule under Mandela's leadership 23 years ago.
He smiled and hugged other party officials as the results were read out. Mr Zuma sat stoney-faced as Mr Ramaphosa's victory was announced.
Political instability, including the questions over who would replace Mr Zuma, has been cited by credit rating agencies as a big factor behind their decision to cut South Africa to "junk".
Economic growth in Africa's traditional powerhouse has been lethargic over the last six years and the jobless rate stands near record levels.
Mr Zuma has faced allegations of corruption since he became head of state in 2009 but has denied any wrongdoing.
The president has also faced allegations that his friends, the wealthy Gupta businessmen, wielded undue influence over his government would be investigated.
Mr Zuma and the Guptas have denied the accusations.
The 75-year-old president has survived several votes of no-confidence in parliament over his performance as head of state.
Dlamini-Zuma, 68, the president's preferred candidate, had campaigned on pledges to tackle the racial inequality that has persisted since the end of white-minority rule.
The rand currency had risen to a nine-month high of 12.5200 earlier, in as the market priced in a Mr Ramaphosa victory.
Government bonds also closed firmer before announcement that Mr Ramaphosa had won the race.