The two-time reigning World Cup champions scored the game's only four tries in front of 58,197 fans, many supporting the Springboks with Perth home to a strong South African community.
South Africa made 10 changes after a 33-7 triumph last week in Brisbane and overcame a grittier Wallabies in a ferocious contest, with several players forced off with head injuries.
Neither team was comfortable claiming the ball in the air or on the ground after torrential rain.
The Springboks, who boasted 14 World Cup winners, struggled initially to handle the slippery conditions and only led 11-9 at half-time before overwhelming the Wallabies with three second-half tries.
"I'm happy for the players, who took their chances and showed us what they could do," said South Africa coach Rassie Erasmus.
"The whole game was nerve-racking. It was tough to play beautiful rugby in this weather but it was a satisfying victory."
It was an improvement from the Wallabies who, despite running out of gas, played with a harder edge after their physicality had been questioned.
They made five changes, with powerful winger Marika Koroibete proving an inspired inclusion in his first Test since last year's World Cup.
But the Wallabies' chances of an upset sank when their front row of captain Allan Alaalatoa, Angus Bell and James Slipper all suffered head knocks.
Inside centre Hunter Paisami and hooker Josh Nasser also suffered leg injuries.
"I was really proud of the way we hung in to half-time," Australia coach Joe Schmidt said.
"We got a little dishevelled in the pack. It (injuries) made our maul defence less able to be structured."
Pumped-up Australia
Australia's record has now slipped to 3-2 under new coach Schmidt, who had given his team a dressing down after the first Test defeat.
After a slow start in Brisbane, a pumped-up Australia hit the ground running and a breakout penalty was calmly converted by fly-half Noah Lolesio.
The Springboks were sloppy in the early exchanges, making uncharacteristic errors.
They were ignited by a dashing Cheslin Kolbe, but his pass was fumbled by Sacha Feinberg-Mngomezulu and a certain try went begging.
South Africa were rewarded for a period of dominance when fullback Aphelele Fassi finished off a chain of slick passes from transition in a spectacular opening try.
The Springboks threatened to pull away but failed to capitalise on several fast break chances.
They also suffered a blow when stand-in captain Salmaan Moerat was forced off the field with a head injury.
The Wallabies hit back and could have led at the interval only for Lolesio to spray a penalty from 25 metres to the right.
South Africa came out aggressively after half-time with Marco van Staden barrelling over the line to extend their lead.
Heavy rain lashed the ground before reserve Max Jorgensen sparked the home team on debut.
However, South Africa proved formidable in the maul and Malcolm Marx barged over for two late tries as their bid to end a five-year title drought in the competition started strongly.