South Africa's ruling ANC has lost control of the economic hub of Johannesburg for the first time since the end of apartheid, after local government councillors elected an opposition candidate as mayor.

Herman Mashaba of the liberal centre-right Democratic Alliance takes over from incumbent mayor and ANC candidate Parks Tau, just days after the ruling party also lost power in the capital, Pretoria.

"The mayoral results is as follows: 125 for Parks Tau and 144 for Herman Mashaba," announced city council speaker Vasco da Gama.

Johannesburg, the country's largest city and its economic nerve centre, is the third big metropolitan the ANC has lost in municipal elections this month.

The party of Nelson Mandela emerged as the largest party in the city after the 3 August vote but failed to secure an outright majority, taking 44.5% compared to the DA's 38.37%.

With 11% of the vote, the radical leftist Economic Freedom Fighters found itself in the powerful position of kingmaker and vowed not to give any of its council votes to the ANC.

Mr Mashaba's election came after a marathon 11-hour sitting at Johannesburg city hall, where an ANC councillor collapsed and later died, delaying proceedings into the late evening.

Mr Mashaba paid tribute to the councillor before vowing to "bring change" to the city.

"People today with no toilets are expected to live in a city regarded as a world class city," he said.

"This is not fair, this is not what South Africa should be. Let's get this city working again so we can give our people dignity."

A successful businessman and millionaire better known for his rags-to-riches story, the 56-year-old is widely seen as a political rookie.

Born to a domestic worker mother, he is a university undergraduate drop-out whose beauty product business became a household brand in South Africa.