Cyril Ramaphosa has become South Africa’s president after embattled leader Jacob Zuma resigned.
The new president was the only candidate nominated in parliament on Thursday and the announcement was welcomed by singing in the National Assembly.
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 the 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.
It is often said that Mr Ramaphosa has had his eye on the position of president since the ANC came to power in 1994.
The story goes that he was so upset at not having been chosen by Nelson Mandela as his successor that he left politics and went into business.
But Mr Ramaphosa has now finally realised that dream.
He has said his priority is reviving South Africa’s battered economy. But it won’t be easy: Unemployment is currently at almost 30%, a rate which rises to nearly 40% for young people.
Low growth rates and dwindling investor confidence were compounded by two credit agencies downgrading the economy to junk status.
One of the first steps in improving that investor confidence is addressing the persistent claims of corruption at the heart of government.
There is a renewed sense of hope as Mr Ramaphosa is taking over the reins of Africa’s most industrialised economy.
The markets appeared to welcome Mr Zuma’s resignation. The South African currency, the rand, reaching its strongest levels in three years – at 11.6570 rand for $1 in early trading.
Some will miss him though, pointing to achievements like announcing the abolition of fees for higher education, says the BBC’s Milton Nkosi in Johannesburg.
Mr Zuma, a former member of the ANC’s military wing in the days of apartheid, rose through the ranks of the party to become president. He led the country for more than a third of its time after apartheid.
But he leaves office with several scandals hanging over him, and with South Africa’s economy in dire straits.
On Wednesday, police swooped on the Johannesburg home of the powerful and wealthy Gupta family.
Eight suspects appeared in court on Thursday on fraud and money laundering charges, local media report. But they did not include any of the best-known Gupta brothers – Ajay, Atul and Rajesh.
Among the eight in court was Varun Gupta, who was Chief Operating Officer of the Gupta-owned mining firm Oakbay Resources and Energy. He is yet to make a plea in court.
The Guptas have been accused of using their close friendship with the president to wield enormous political influence. They deny all allegations of wrongdoing.
Cyril Ramaphosa at a glance:
Detained in 1974 and 1976 for anti-apartheid activities
Chairman of committee which prepared for Nelson Mandela’s release from prison in 1990
Had hoped to succeed Mandela as president but Thabo Mbeki chosen instead
Moved full-time into business in 1997, becoming one of South Africa’s richest businessmen
On Lonmin board during 2012 Marikana massacre
Elected ANC leader in 2017
Becomes president of South Africa on 15 February 2018