Australia 231 (Carey 47, Lynn 44, Rabada 4-54, Pretorius 3-32) beat South Africa 9 for 224 (Miller 51, du Plessis 47, Stoinis 3-35) by seven runs
Adelaide: Australia snapped a seven-game losing streak to beat South Africa by seven runs in the second one-dayer in Adelaide on Friday, keeping the series alive and boosting their battered confidence.
Set 232 to win, the Proteas could only manage 224-9 in their 50 overs, leaving the series tied at 1-1 with the decider in Hobart on Sunday
The hosts, who were thrashed by six wickets with more than 20 overs to spare in the opening match, dug deep with their bowlers getting them over the line.
Marcus Stoinis was the pick with 3-35 off his 10 overs, including the crucial scalp of David Miller, who hit a stubborn 51.
Adelaide has been a happy hunting ground in the past for Australia.
In fact, their last win came at the Oval nine months ago against England, before the reigning world champions were knocked for a six by the ball-tampering scandal in South Africa in March.
Their form slump since had been characterised by batting collapses and they again struggled to compile a big total with some tight South African bowling putting them back in the pavilion for 231.
But with Mitchell Starc returning to new-ball duties after a short-lived experiment with Nathan Coulter-Nile in Perth backfired, the attack did its job.
Starc got a reward in his third over, with Adam Zampa getting under a catch in the deep to end Quinton de Kock's night.
Aiden Markram and Reeza Hendricks were looking dangerous as they pushed the score to 46, but they needlessly attempted a third run from a clip off the pads to midwicket and Markham was run out.
Six balls later and Hendricks was also in the clubhouse, getting an outside edge off Josh Hazlewood to give Australia hope.
And when Heinrich Klassen fell to Stoinis to leave the Proteas on 68-4 the crowd came alive, sensing the miserable run could be over.
Faf du Plessis and Miller set about building a 74-run partnership before Pat Cummins got a breakthrough with the South African skipper dragging the ball onto his stumps on 47.
Miller dug in as partners fell to grind out a gutsy 51 before he was given out lbw on a review decision and the South African tail failed to wag.
Australian skipper Aaron Finch stressed beforehand the need to go back to basics and build partnerships, and he and Travis Head tried to set the tone after being sent into bat.
But Head's aggressiveness cost him and he was trapped him lbw for eight.
That brought Shaun Marsh to the crease and he quickly got into his groove.
He and Finch knocked up a 50-partnership before Marsh, on 22, got a thick edge off Rabada and de Kock took the catch.
Finch built a composed 41 before he was deceived by a Dwaine Pretorius delivery and chopped the ball onto his wicket.
The explosive Chris Lynn was in Twenty20 mode when he smacked 18 off the first four balls of a Rabada over before he pushed his luck too far on the fifth, mistiming a hook and was caught.
With wickets falling, Alex Carey worked hard to make 47 before becoming Rabada's third victim.