"We didn't play tactically well, but in the second half, the guts the boys showed, the character, is great," said Springboks coach Rassie Erasmus.
Halfback Faf de Klerk added a second try for South Africa before, down 14-0, Australia responded with scores by Reece Hodge and Will Genia in a three-minute spell.
But Springboks first five-eighths Handre Pollard kicked three penalties in a row and Australia out of the game.
Pollard's third penalty, in the sixth minute of the second half, was the final score by either team.
Australia ran the game after that but South Africa's defence wouldn't give in, even when down to 14 men from a yellow card to Dyantyi in the 65th.
"We got to a position where, backend of the game, we had some huge opportunities to make some points and couldn't get there," Australia captain Michael Hooper said.
"We take one try there [when South Africa is down to 14 men], we're in with a chance of winning the game. We didn't take that try."
South Africa have two straight wins after surprising the All Blacks - and world rugby - in the last round.
Australia have lost two in a row and won just twice in their last 10 games.
"No one wants to win more than me, trust me," said coach Michael Cheika, who is under pressure to keep his job for the Rugby World Cup next year. "The tough situations come and they go away and the tough people will stay.
"It depends if you want to cry about it and sook, or get on with getting improvements."
Although brave in defence, South Africa didn't follow through on a dominant start in attack, when Dyantyi took advantage of an adventurous and ultimately foolish decision by Beale to throw a long pass outside him when standing in front of his own goalposts. The South Africa wing pounced for a sixth try in eight tests.
De Klerk and Pollard combined for the second try but South Africa's control of the game dissipated after that and the Boks defended almost without let-up for the last 35 minutes, with blindside flanker Pieter-Steph du Toit earning man of the match for making a mountain of bruising tackles again, like he did in New Zealand.
"At the end of the game, I sometimes ask if it's worth it," Du Toit said, "but it's a happy pain."
The Wallabies were coming off a shock first home loss to Argentina in 35 years. Cheika said there were some positives despite defeat again.
"Hey, we were down 14-0 in a bit of a cauldron atmosphere," he said, "and considering where we've been in the last few weeks and everything that's been happening to us, I suppose, we held our nerve really well and fought our way back into the game."
South Africa and New Zealand meet in South Africa in the last round next weekend, while Australia play in Argentina. The All Blacks wrapped up the title with a game to spare.
- AP