Cyril Ramaphosa was re-elected in the May 29 general election
Cyril Ramaphosa was re-elected in the May 29 general election AFP

South Africa's Cyril Ramaphosa is to be sworn in as president at a ceremony in Pretoria on Wednesday, after his weakened African National Congress (ANC) struck a government coalition deal.

Lawmakers voted overwhelmingly to re-elect the 71-year-old last week, after a May 29 general election that produced no outright winner.

"It will once again be a privilege and a pleasure to once again service this nation," Ramaphosa told parliament on Friday.

He will officially inaugurate his second five-year term on Wednesday before MPs, foreign dignitaries, religious and traditional leaders and others at the Union Buildings, the seat of government.

The presidency said almost 20 heads of state and government, many from neighbouring nations, are expected to attend, and additional confirmations were being received.

Among countries that "will be represented at a high level", it listed China, Egypt, Cuba, Zimbabwe, Angola and the State of Palestine.

The ceremony will include music and artistic performances, a 21-gun salute and a fly past by the air force.

Ramaphosa will be sworn in by the head of the constitutional court, Chief Justice Raymond Zondo, and then deliver an inaugural address.

It will be the third time Ramaphosa takes the oath.

The former trade unionist turned millionaire businessman first came to power in 2018, after his predecessor and rival Jacob Zuma was forced out before the end of his term under the cloud of corruption allegations.

Ramaphosa was then re-appointed for a full five-year term in 2019. In South Africa, voters elect the parliament which then votes for the president.

Ramaphosa promised a new dawn for South Africa, launched an anti-graft drive and started to reform a collapsing energy system.

But under his watch, the economy languished, blighted by power cuts, crime remained rife and unemployment increased to 32.9 percent.

In May, he led the ANC into yet another vote, but the historied party of the late Nelson Mandela came out bruised.

It won only 40 percent of the vote -- down from 57.5 percent five years earlier.

For the first time since the advent of democracy in 1994, it lost its absolute majority in parliament and was left scrambling to find coalition partners to remain in power.

It has since agreed to form what it calls a national unity government with several other parties.

They include the centre-right Democratic Alliance (DA), the Zulu nationalist Inkatha Freedom Party, the anti-immigration Patriotic Alliance and the small centre-left GOOD party.

The deal allowed Ramaphosa to comfortably see off a last-minute challenge by firebrand leftist politician Julius Malema, with 283 lawmakers in the 400-seat National Assembly voting to put him back in office.

The president is expected to announce his cabinet within days of his inauguration, as talks with coalition members continue.