“Ramaphosa has a better chance of renewing confidence, not only in the markets, but also inside the A.N.C., where reformers may now feel they have a place,” said William Gumede, the executive chairman of the Democracy Works Foundation, a good-government group. “The mood in this country in the last couple of years has been so depressed that he’ll bring a new energy.”
But as a wealthy member of Mr. Zuma’s government who was largely silent in the face of cronyism and corruption, Mr. Ramaphosa is seen by critics as more a creature of that system than an honest broker and corruption fighter.
Mr. Zuma, who will cease to be party leader this week but whose term as the country’s president does not end until 2019, will leave his successor a number of problems, but one above all: a once-heroic liberation party that has now become associated with graft, cronyism and incompetence and has been losing core supporters.
As delegates waited for the official results to be announced Monday evening at a national conference in Johannesburg, Mr. Ramaphosa could be seen joyfully greeting and hugging well-wishers on the stage, and posing for selfies. Ms. Dlamini-Zuma mostly sat expressionless. President Zuma sat sipping from a cup of tea.
As expectations of a Ramaphosa win heightened, South Africa’s currency, the rand, gained sharply — reflecting the business community’s preference for him. Senior political figures began tweeting congratulatory messages to Mr. Ramaphosa.
When the results were finally announced, Mr. Ramaphosa’s supporters erupted in celebration while his rival’s backers sat in stony silence — evidence of the wide divide that the new party leader will have to bridge.
With his victory on Monday, Mr. Ramaphosa is almost certain to become South Africa’s next president, thanks to the A.N.C.’s dominance in Parliament, which chooses the nation’s leader. A Ramaphosa victory, experts and allies have said, will strengthen the A.N.C. before the elections in 2019.
“He’s always been, in his history, an incredibly smart negotiator,” said Barbara Hogan, an anti-apartheid veteran who served in Mr. Zuma’s cabinet for two years and supported Mr. Ramaphosa. “He’s always got the long view in mind.”
“He’s not the type who would smash an organization for his own ego,” Ms. Hogan added, alluding to Mr. Zuma, who some believed had come to put his own interests above the party’s.
Largely because of older black voters who intimately remember the A.N.C.’s heroic past, the party is still considered the favorite to win the next general election. But party leaders have been alarmed at the A.N.C.’s rapid decline and Mr. Zuma is so widely discredited that party leaders could replace him with Mr. Ramaphosa before the 2019 elections to improve the A.N.C.’s chances.
A.N.C. officials are hopeful the party can regain its previous stature under Mr. Ramaphosa, whose core supporters are precisely in those categories — city dwellers and business owners, along with the black middle class — that had begun to drift away.
“We don’t want to be relegated to a rural party,” Gwede Mantashe, the A.N.C.’s secretary general and a Ramaphosa ally, said as voting was taking place on Monday. “We want to regain the metros and be a strong A.N.C.”
The two contenders embodied opposing strains in the A.N.C., the heroic 105-year-old liberation movement that, in recent elections, clung increasingly to its glorious past to bring voters to the ballot box.
Under Mr. Zuma, whose presidency has been marred by a series of personal and political scandals, the A.N.C. had become a patronage machine that rewarded the faithful and made them dependent on the party.
Neither candidate offered a clear vision or detailed program on how to address the myriad problems afflicting South Africa, the continent’s most sophisticated economy but a deeply unequal one that offers little hope of upward mobility for the vast majority of impoverished black South Africans.
A skilled union organizer, Mr. Ramaphosa served as Mr. Mandela’s key negotiator in the talks that led — peacefully, against many odds — to the end of apartheid in 1994.
He was Mr. Mandela’s choice to become deputy president and eventually his successor as the nation’s leader. But the powerful coterie of anti-apartheid leaders in exile pressed successfully for Thabo Mbeki.
Mr. Ramaphosa turned down Mr. Mandela’s offer to become foreign minister and eventually entered the private sector, though he remained on the A.N.C.’s national executive committee.
Using his ties to the party, Mr. Ramaphosa quickly became one of the richest businessmen in the country and on the continent. He acquired interests in many areas, including South Africa’s McDonald’s restaurants, and served on a multitude of corporate boards.
He was on the board of Lonmin, a mining company, when the police shot dead 34 wildcat strikers at a platinum mine in Marikana in 2012, in the deadliest killing of civilians since the end of apartheid. Though an official inquiry into the massacre absolved him of guilt, it found that he had tried to intervene with the authorities on behalf of the company.
“The terrible events that have unfolded cannot be described as a labor dispute,” Mr. Ramaphosa wrote in an internal email after the first 10 strikers had been killed. “They are plainly dastardly criminal and must be characterized as such. In line with this characterization, there needs to be concomitant action to address this situation.”
Mr. Ramaphosa later apologized for the language he used but said that he was trying to prevent further deaths.
To many, Mr. Ramaphosa became the symbol of an A.N.C. elite that had enriched itself by betraying the people it had once promised to serve. In another episode in 2012, Mr. Ramaphosa was widely criticized for bidding $2 million for a prize buffalo cow at a livestock auction.
He apologized for that as well. “It is a mistake in the sea of poverty. I live in a community,” he said. “The damage has been done, I will live with it.”
That same year, Mr. Ramaphosa returned to politics, and has served since 2014 as deputy president under Mr. Zuma. Mr. Ramaphosa supported Mr. Zuma, staying largely silent as the president’s ethical problems and erratic policies damaged the economy.
More recently, though, Mr. Ramaphosa began to distance himself from Mr. Zuma. Last month, he gave a long speech on the economy, focusing on the importance of fighting corruption.
His supporters portrayed him as the man capable of righting the A.N.C. Jackson Mthembu, the party’s chief whip, said on Twitter that he had cast his ballot for Mr. Ramaphosa and “other five incorruptible leaders” for the national executive committee. “My vote is to save” the A.N.C. “and my country. We must!!”
But to others, it is not yet clear that an insider can dismantle the very system that so richly rewarded him.