In the most extraordinary one-dayer ever, the home side's victory was achieved with one ball to spare and sparked wild celebrations on and off the Wanderers pitch.
Before Sunday, no side had scored more than 400 in a one-day international and South Africa's total topped Australia's record 434 for four earlier in the day.
A total of 872 runs were scored. The previous record was 693 when India [ Images ] beat Pakistan by five runs in Karachi in March 2004.
The previous innings record was the 398 for five Sri Lanka [ Images ] scored against Kenya in Kandy in 1995-96.
World champions Australia had been 2-0 down in the series, suffering a record 196-run loss in the second match, before drawing level at 2-2.
After winning the toss and choosing to bat, Ponting reached his century off 73 balls. In all he faced 105 deliveries, hitting 13 fours and nine sixes.
Gibbs then kept the home side up with the required scoring rate by blazing 175, including seven sixes, off 111 balls. Captain Graeme Smith [ Images ] also scored 90, putting on 187 for the second wicket with Gibbs.
Gibbs's was the second highest score by a South African after Gary Kirsten's 188 not out against the United Arab Emirates [ Images ] at the 1996 World Cup.
Ponting is the first Australian to reach 9,000 runs in one-day internationals and his innings was the third highest by an Australian.
The two batsmen were jointly awarded man of the match but Ponting declined it, saying Gibbs deserved the honour alone.
Andrew Hall [ Images ] dived to his left at mid-on to scoop a stunning catch and remove Gilchrist for 55.
Katich and Ponting piled on 119 runs for the second wicket until Katich cut a delivery from Makhaya Ntini [ Images ] and was caught by Telemachus at third man for 79.
Ponting and Michael Hussey [ Images ] shared 158 for the third wicket before Hussey, who scored 81, tried to heave a ball from Hall over long-on and was caught by Ntini.
Ponting was dismissed in the 48th over when his lofted drive to a ball from Jacques Kallis [ Images ] was caught by Boeta Dippenaar.
Graeme Smith and Gibbs kept the home side on course with a lusty second-wicket stand of 187 off 128 balls, South Africa's highest partnership for any wicket against Australia.
It was ended in the 23rd over when Smith drove a catch off Michael Clarke [ Images ] to Hussey at deep midwicket to go for 90.
Gibbs dominated a stand of 94 in which AB de Villiers [ Images ] scored just 14, and the centurion went in the 32nd over when he drove one of Andrew Symonds' [ Images ] off-spinners down Brett Lee's [ Images ] throat at long-on.
That slowed South Africa's momentum, but number eight Johan van der Wath revived their hopes by scoring 35 off 18 balls while Mark Boucher [ Images ] rotated the strike intelligently.
Australia surged back by dismissing Van der Wath, Telemachus and Hall in the space of 18 deliveries to reduce South Africa to 433 for nine with three balls left in the match.
Number 11 Ntini nudged Lee to backward point for a single, and Boucher, who ended on 50 not out, slammed the next ball through long-on for four to win the match.
Mick Lewis' return of nought for 113 was the most expensive bowling analysis in 50-over one-day internationals.