Australia 243 (Warner 63, Rabada 5-96, Ngidi 3-51) and 180 for 5 (Khawaja 75, Rabada 3-38) lead South Africa 382 (de Villiers 126*, Elgar 57, Amla 56, Cummins 3-79) by 41 runs
Port Elizabeth: Australia face an uphill battle in Port Elizabeth after the brilliance of AB de Villiers (126*) and Kagiso Rabada (3/38) seized the advantage for South Africa.
Day three began with the match evenly poised but de Villiers' first Test century since January 2015 helped the Proteas to 382, a first-innings lead of 139, before South Africa's attack left Australia 180/5.
Rabada was inspired once again with the ball, adding to his five-for in the first innings with the wickets of David Warner - who was bowled by a pearler - Shaun Marsh and, just before stumps, the crucial wicket of Usman Khawaja, who had battled hard for his 75.
With Cameron Bancroft - who was bowled by Lungi Ngidi after his defensive stroke tricked back off his foot and onto his stumps - and Steve Smith, who edged behind off Keshav Maharaj for 11, also back in the hutch, Australia's hopes rest on Mitchell Marsh (39*) and the lower order extending their lead well beyond the 41 runs that it currently stands.
The day had started with a magnificent innings from de Villiers that will be remembered as one of the very best, if not the best, of his Test career.
On a pitch that has proved challenging for batsmen from ball one, he seemingly scored at will, manipulating the ball into the gaps with ease and hitting 20 fours and one six.
After reaching 74 not out at stumps the previous evening, he started sedately before moving through the gears with two boundaries in Josh Hazlewood's fourth over of the day; the first delightfully flicked through mid-on and the second deftly guided to the third-man boundary.
The next ball he faced, from Pat Cummins, also raced to the boundary as de Villiers swatted a pull stroke for four off the front foot.
Cummins got the first breakthrough of the morning when Vernon Philander, who hit a useful 36, could only fend a short ball to short-leg where Bancroft took a smart catch, but de Villiers was raising his bat two deliveries later after expertly ramping the same bowler over the slip cordon to bring up his century in 116 balls.