Durban: David Miller hit a sensational century as South Africa pulled off the second highest ODI run-chase of all time on Wednesday in a four-wicket triumph over Australia at Kingsmead.
Miller hit 118 not out off 79 balls as South Africa chased down what had been a ground record 371 for six by Australia with four balls to spare.
"It took a freakish innings to win the game. It was an amazing knock," said South African captain Faf du Plessis.
David Warner and skipper Steve Smith hit centuries for Australia and seemed to have done enough to get their team back into the series after losing the first two matches of the five-game series.
"I said at the toss that we needed one batsman to get a hundred and two of us did it," said Smith.
"You don't lose too many games with 370 on the board but credit to South Africa. David Miller played an absolute blinder."
The match seemed all but won for Australia when 20-year-old Andile Phehlukwayo joined fellow left-hander Miller with South Africa precariously placed at 265 for six.
Phehlukwayo survived a confident appeal for a catch behind the wicket off Chris Tremain before he had scored but Australia did not have a review left. Replays showed a clear edge.
Phehlukwayo made 42 not out and helped Miller see South Africa home with an unbeaten partnership of 107 off 74 balls as Australia's inexperienced bowling attack once again failed to contain the home team's batsmen.
The left-handed Warner hit 117 off 107 balls and captain Smith made 108 off 107 deliveries.
It was only the third time in 42 one-day internationals that a team had made 300 or more at Kingsmead, a ground which seldom yields big totals.
South Africa were always close to the required rate, with opener Quinton de Kock making 70 off 49 balls, but the hosts kept losing wickets.
Miller, though, was undeterred despite hobbling between wickets because of a groin strain.
He hit ten fours and six sixes, one of them bouncing off a grandstand roof out of the ground, in making his third one-day international century.
"It was the best win that I have been involved in," said Du Plessis. "Most teams would have felt they were dead and buried."
Warner made his runs off 107 balls, with 13 fours and two sixes, while Smith, who said at the toss that "every match is a final for us" after they lost the first two games, faced 107 balls and hit nine fours and a six.
Warner and Aaron Finch gave Australia a blazing start, putting on 110 for the first wicket off 81 balls, with fast bowler Dale Steyn coming in for particularly heavy punishment, with both batsmen hitting sixes off him.
Although Steyn picked up two wickets late in the innings, he conceded 96 runs in ten overs, the most by a South African in one-day internationals.
Fellow fast bowler Kagiso Rabada was also expensive, taking one for 86 in ten overs.