Australia took a giant step towards a series lead on day four of the second Test against South Africa at the Adelaide Oval.
Michael Clarke's men set the Proteas an improbable 430 runs for victory before claiming four wickets to leave South Africa tottering on 77-4 heading into the final day.
Any hopes of saving the match will now rest on AB de Villiers and Faf du Plessis, who repelled Australia for a large part of the final session to give the tourists an outside chance of forcing a draw.
De Villiers reached the close unbeaten on 12 from 101 deliveries and Du Plessis battled to an unbeaten 19 from 74 balls.
The pair came together after South Africa lost four quick wickets either side of tea.
Captain Graeme Smith was the first batsman to depart for a second ball duck, edging Ben Hilfenhaus to Ricky Ponting in the slips to send the home fans into raptures.
Spinner Nathan Lyon was quickly introduced into the attack and the move paid dividends as he induced an edge from a driving Hashim Amla and captain Clarke claimed a comfortable catch at slip.
And the tourists looked set for a speedy defeat when Lyon, who two years ago worked as a groundsman at the Adelaide Oval, got Jacques Rudolph to poke the ball to Ed Cowan, who lunged low and to his left to take a sharp catch at short leg.
Alviro Petersen's celebrations for his 32nd birthday were then tempered an over later, when he was out for 24, dragging a Peter Siddle delivery onto his stumps to leave his team reeling at 45-4.
Charged with steering South Africa to safety, De Villiers and Du Plessis slowed their scoring to a crawl, with any thoughts of victory apparently banished.
Australia effectively batted South Africa out of the game earlier in the day by moving their overnight total on from 111-5 to 267-8 declared.
Mike Hussey top-scored with 54 before a ninth-wicket stand of 47 between James Pattinson, who has been ruled out of the remainder of the Australia season through injury, and Hilfenhaus.