The spinners backed up a century by Aiden Markram as the Proteas claimed a 111-run victory against Australia in the third ODI in Potchefstroom on Tuesday.
Markram hit 102* in a South African total of 338-6.
The Proteas 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 T20I 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-1 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 (2-29) and Keshav Maharaj (2-37) changed the course of the match on a spin-friendly pitch before fast bowler Gerald Coetzee (4-50) finished off the Australian innings.
Blink and you might miss it! 👀
Quinton de Kock pulls off a sensational stumping to dismiss Stoinis.
Unreal glove work 🙌
📺 Stream live now: https://t.co/ACEUH7ehZ3 | #SAvAUS l pic.twitter.com/O44v9RpVpH
— SuperSport 🏆 (@SuperSportTV) September 12, 2023
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 Proteas 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.”
Australia 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 learned a lot from it,” he said.
Quinton de Kock (82) and captain Temba Bavuma (57) gave the Proteas 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 2-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.
© Agence France-Presse