James Faulkner hit the winning boundary with five balls to spare to give Australia a thrilling two-wicket victory over South Africa on Sunday and push them to the top of the ICC one-day rankings.
The Australians were cruising towards a rain-reduced victory target of 275 in Sydney but then lost four wickets for three runs to give the Proteas a late chance of victory.
But Faulkner (six not out) got Australia over the line with a sweep for four off spinner Robin Peterson, who had bowled the Proteas into contention with four wickets.
Australia secured a 4-1 series win and nudged ahead of India to top the one-day rankings, less than three months before the start of the World Cup in Australia and New Zealand.
Wicketkeeper Quinton de Kock was named man-of-the-match in a losing side for his 107 off 123 balls in South Africa's innings after they had won the toss.
The Australians seemed in control of the run chase with Aaron Finch scoring 76 (67 balls), Shane Watson 82 (93 balls) and man of the series Steve Smith 67 (74 balls).
But some reckless batting coupled with Peterson's mesmerising spin brought South Africa back into contention after the loss of Glenn Maxwell, Smith, skipper George Bailey, Matt Wade and Pat Cummins.
Faulkner got the Australians home in the final over.
"We made it a bit difficult for ourselves in the end and Jimmy (Faulkner) again got us home so it's nice to win the series 4-1," Smith said.
"We were a bit nervous sitting and watching and we were actually feeling a little bit sick, I don't know what happened, and luckily Jimmy came out and rescued us again."
The South Africans never gave in and coupled with Peterson's bowling, Rilee Rossouw took four catches, including a sprawling effort to dismiss Smith in the outfield at a pivotal time in the match.
De Kock hit the first one-day century by a South African at the Sydney Cricket Ground to help his team to 280 for six.
The wicketkeeper's 107 off 123 balls with 14 fours was his sixth ODI hundred but first against Australia.
In the absence of injured skipper AB de Villiers, de Kock stepped up to play a valuable innings for the Proteas, who were looking to avoid a fourth defeat in the five-game ODI series.