South Africa put on a display of pomp and ceremony on Wednesday for Cyril Ramaphosa's inauguration as president for a second term that will see his African National Congress share power with other parties after it lost its majority in parliament.

African heads of state and dignitaries gathered outside the Union Buildings in Pretoria, seat of the South African government, to watch Ramaphosa's motorcade arrive with a guard of honour on horseback.

Ramaphosa will head what he calls a government of national unity with five other parties, including the ANC's largest rival and virulent critic, the pro-business Democratic Alliance.

While investors have welcomed the inclusion of the DA, which wants to boost growth through structural reforms and prudent fiscal policies, analysts say sharp ideological divisions between the parties could make the government unstable.

Just before the election, Ramaphosa signed into law a National Health Insurance bill that the DA says could collapse a creaking health system. It was unclear what would happen to that law under the new government.

The DA advocates scrapping the ANC's flagship Black economic empowerment programme, saying it hasn't worked -- a highly contentious topic in a nation grappling with huge inequalities, some inherited from apartheid.

Ramaphosa has yet to announce the make-up of his new government, which he will have to negotiate with members of the new alliance.

"The president does not want the country to go through a prolonged period of uncertainty," his spokesman Vincent Magwenya told state broadcaster SABC.

"This time around, there is a small layer of complexity in that he has to consult with the various parties that form part of the government of national unity. Those consultations have been underway. They will continue, even tonight," he said.

A former liberation movement, the ANC came to power under Nelson Mandela's leadership in the 1994 elections that marked the end of apartheid. Once unbeatable, it has lost its shine after presiding over years of decline.

It remains the largest party after the May 29 election, with 159 seats out of 400 in the National Assembly, but lost millions of votes compared with the previous election in 2019. The DA's vote share remained stable and it has 87 seats.

Voters punished the ANC for high levels of poverty, inequality and unemployment, rampant crime, rolling power cuts and corruption in party ranks. (Additional reporting by Nellie Peyton; Writing by Estelle Shirbon; Editing by Bernadette Baum)