Cyril Ramaphosa had played a prominent part in the struggle against white minority rule.

South African lawmakers on Wednesday re-elected Cyril Ramaphosa as the nation's president, two weeks after the ruling ANC party returned to power in legislative elections.

Ramaphosa was "duly elected president of the Republic of South Africa," chief justice Mogoeng Mogoeng told parliament after Ramaphosa was the only name nominated by lawmakers in Cape Town.

MPs from the African National Congress, which won 230 out of 400 seats on May 8, choose the head of state in the parliament's first post-election sitting.

The ANC won the ballot with 57.5 percent of the vote, its thinnest majority since the end of apartheid.

Ramaphosa will be sworn in on Saturday and name a deputy president and cabinet at the weekend.

Under South Africa's 1996 constitution, electors vote for a party, and the party selects individuals who go to the National Assembly, which then chooses the head of state.

Ramaphosa, 66, is a trade unionist who played a prominent part in the struggle against white minority rule before becoming a successful businessman after the end of apartheid.

He will serve his first full five-year term since taking over last year from Jacob Zuma who was forced out over a series of corruption scandals.

Ramaphosa's first test as he starts his new term will be his choice of a cabinet -- a task beset by rival factions within the ANC.