South African President Cyril Ramaphosa has won a second term in office after being re-elected by lawmakers with 283 votes.
The move comes after his African National Congress (ANC) party and its main rival, the white-led, pro-business Democratic Alliance (DA), agreed to form a government of national unity.
The ANC has been in power since the end of apartheid in 1994, losing its majority for the first time in the 29 May vote.
It keeps 159 seats in the 400-seat National Assembly, which has been housed in a convention centre in Cape Town since the parliament complex was badly damaged in a fire in 2022.
The DA now has 87 seats.
Unity or coalition government?
The terms of the coalition deal are still being ironed out.
"The ANC is going into this under the guise of a government of national unity, but really it isn't," political analyst Hlengiwe Ndlovu of the Wits University School of Governance told the French news agency AFP.
"It's more like coalition talks."
South Africa's two major leftist parties – the hard-left Economic Freedom Fighters (EFF) and graft-tainted former president Jacob Zuma's new uMkhonto weSizwe (MK) party – shunned the deal.
The MK has 58 seats and the EFF 39, while the socially conservative Inkatha Freedom Party (IFP), which has its base in the Zulu community, won 17 seats.
The IFP was the first to confirm it would take part in a unity government.
ANC secretary general Fikile Mbalula said the government would "gravitate to the centre".
(with newswires)