South Africa's governing African National Congress (ANC) has suffered its worst electoral setback since apartheid ended in 1994.
With 99% of the votes counted after Wednesday's municipal elections, the party has lost the key battleground of Nelson Mandela Bay to the opposition Democratic Alliance (DA).
The two parties are in a close fight for Johannesburg and Pretoria.
But the ANC is still in the lead nationally, with 54% of the vote.
The ANC has had the main share of the vote in South Africa since the end of apartheid more than two decades ago.
Unemployment and corruption scandals surrounding President Jacob Zuma have tarnished the party's image.
The local elections are being seen as an indication of his mid-term popularity.
Mr Zuma will be present when the results are officially announced on Saturday evening, at 18:00 local time (16:00 GMT).
Named after ANC liberation hero and South Africa's first democratically elected president, the loss of Nelson Mandela Bay is a big blow to the party.
Many of the leaders of the struggle against apartheid come from the area.
The DA, which took 46.5% compared to the ANC's 41% in Nelson Mandela Bay, says it is in talks with other parties to form a coalition in the municipality on South Africa's southern coast.
Its leader Mmusi Maimane said Nelson Mandela Bay had voted for change.
"I think that to me says that our message got through - it says our people heard us and South Africans still believe in a dream of a non-racial South Africa, South Africans still want our country to prosper," he said.
The ANC has conceded defeat in Nelson Mandela Bay after initially saying it was going to challenge the result.
Deputy President Cyril Ramaphosa promised the party would learn from the experience: "They think that we are arrogant, they think that we are self-centred, they think that we are self-serving, and I'd like to dispute all of that and say we are a listening organisation."
It looks like no party will win an outright majority in the economic hubs of Johannesburg or Tshwane, which includes the capital, Pretoria, and coalition negotiations are already underway.
BBC South Africa analyst Farouk Chothia says the ANC's urban vote has collapsed with both black middle and working classes switching to DA.
It is a historic moment showing the extent to which people are fed up with corruption and the ANC's failure to deliver on its promises, he says.
ANC's influence in decline: Milton Nkosi, BBC News, South Africa
The municipal election result is probably the biggest wake-up call the governing ANC has received since it ushered in democracy in South Africa in 1994.
Clearly the ANC still commands huge support across the country but that support is waning. It can no longer take it for granted that the black majority will blindly follow it.
The best example is in the Nelson Mandela Bay municipality, won by the DA, which has a rich history of anti-apartheid struggle. Its new DA mayor is Athol Trollip, who is white.
Twenty-two years after the end of apartheid, black people are now voting on issues and not on race. Mr Trollip, who speaks fluent Xhosa, would not be where he is if the vast majority of black people had not voted for him.
Final results are expected later on Friday.
By Friday mid-morning, the ANC had 54%, followed by 26% for the DA and 8% for the radical Economic Freedom Fighters (EFF).
The Inkatha Freedom Party has boosted its support slightly, holding on to parts of KwaZulu-Natal state.
Correspondents say a poor ANC performance could embolden Mr Zuma's rivals within the party to challenge him.
The next general elections are due in 2019 but Mr Zuma cannot stand for a third term as president.
South Africa's economy has also been one of the main issues for voters, with growth expected to be zero this year, and unemployment standing at 27%.
Protests demanding better housing and amenities have sprung up across South Africa.
Mr Zuma has also had to weather a corruption scandal, after being ordered to repay taxpayers' money spent on his private home.
Security was tight for the elections and the electoral commission said voting had passed off smoothly.