Jacob Zuma has defeated South Africa's President Thabo Mbeki to win the leadership of the country's ruling ANC.
Mr Zuma won the votes of more than 60% of the delegates at the leadership conference to claim victory.
The result follows two days of bitter debate, during which President Mbeki was heckled by supporters of Mr Zuma.
Correspondents say that Mr Zuma will now become the frontrunner to take over as president when Mr Mbeki is obliged to stand down in 2009.
Of the 3,834 voting delegates, Mr Zuma received 2,329 to Mr Mbeki's 1,505.
Mr Zuma and his supporters also won a clean sweep of five other top positions in the ANC.
The announcement of the result was greeted with chants of "Zuma, Zuma".
Thabo Mbeki, 65
Succeeded Nelson Mandela as president in 1999
Presided over economic growth
Accused of not doing enough to reduce poverty
Won bid to host 2010 football World Cup
Seen as aloof
From Xhosa ethnic group
Jacob Zuma, 65
Played key role in fight against apartheid
Plagued by corruption allegations
Backed by trade unions, Communist Party
Seen as charismatic
From Zulu ethnic group
Before leaving the platform, Mr Mbeki embraced Mr Zuma and clasped his rival's hand in congratulation.
The BBC's Peter Greste at the conference says the public show of unity was a powerful signal to the rank and file that they needed to heal the rift and get on with the business of running the country.
But the real question is whether Mr Zuma can deliver on that promise of unity and continuity, our correspondent adds.
Although he is strongly placed to become the next national president he could still face corruption charges in connection with a multi-million dollar arms deal.
Should Mr Zuma find himself back in court, the position of the deputy party leader is likely to prove crucial.
The contest for deputy was won by Kgalema Motlanthe, previously ANC secretary general and seen as close to Mr Zuma.
Correspondents say it has been the most divisive contest in the long history of the ANC - for some this is a sign of a healthy democracy in action while others fear the split in the ANC could spell trouble for South Africa.
Delegates were warned to behave or face disciplinary action on Monday after rival supporters tried to out-sing each other amid chaotic scenes.
Zuma supporters sang the anti-apartheid song Bring Me My Machine-gun, during pro-Mbeki speeches while Mbeki supporters retorted by singing Mbeki, My President.
Mr Mbeki had been booed and heckled during his opening speech on Sunday.
This is the ANC's first leadership contest in 58 years.
Mr Mbeki had said claims by the Zuma camp that he had centralised power were false. But growing unpopularity with Mr Mbeki's style of leadership had made Mr Zuma favourite.
Mr Zuma's supporters believe he will do more to reduce poverty in South Africa.
Once close allies, Mr Zuma and Mr Mbeki publicly fell out in 2005 when Mr Zuma was sacked as deputy president over corruption allegations.
The case against Mr Zuma was thrown out by a judge last year. He was also acquitted of rape charges - which he said were politically motivated.
Mr Zuma provoked outrage among Aids activists over the case when he said he had showered after sex with the HIV-positive woman to prevent infection.
Former President Nelson Mandela has said he is saddened by "the nature of the differences currently in the organisation".
The former Archbishop of Cape Town, Desmond Tutu, has said neither Mr Zuma or Mr Mbeki were suitable candidates.