South Africa's spin bowlers backed up a century by Aiden Markram as the hosts ended Australia's winning streak with a 111-run victory in the third one-day international at the JB Marks Oval in Potchefstroom on Tuesday.
Markram hit 102 not out in a South African total of 338 for six.
South Africa survived a furious assault by David Warner and Travis Head before bowling out Australia for 227.
Australia won the first two games in the five-match series after sweeping a Twenty20 series 3-0.
The tourists looked on track for another win when Warner and Head thrashed 79 for the first wicket off only 48 balls.
Australia were 104 for one at the end of the 10-over power play, the second time in a row they reached three figures while fielding restrictions were in place.
But left-arm spinners Tabraiz Shamsi (two for 29) and Keshav Maharaj (two for 37) changed the course of the match on a spin-friendly pitch before fast bowler Gerald Coetzee (four for 50) finished off the Australian innings.
Maharaj also made a key intervention in the field with a direct-hit run-out of Warner, who made 78 off 56 balls before slipping and losing his shoe as he set off for a single.
"We needed a positive one," said South African captain Temba Bavuma.
"The batters knuckled down and we were banking on the wicket assisting the spin bowlers and it's exactly what it did.
"The power play didn't go as well as we wanted but the way we clawed it back was exactly what we're looking for."
Australian captain Mitchell Marsh said the loss was "a little slip-up" in conditions which are likely to be replicated during the World Cup in India next month.
"Hopefully we learnt a lot from it," he said.
Quinton de Kock (82) and captain Temba Bavuma (57) gave South Africa an ideal start with an opening stand of 146 in 22.5 overs.
But Australia were able to slow down the scoring, with part-time off-spinner Travis Head making good use of a slow, dry pitch to bowl unchanged and take two for 39 in 10 overs.
Markram and Marco Jansen gave the innings late impetus with a sixth-wicket partnership of 63 off 31 balls which was ended by a sensational diving left-handed catch by Sean Abbott on the cover boundary off Nathan Ellis.
str/jc