Australia led by just 30 runs after a fine start by openers Phil Hughes and Shane Watson was almost thrown away by a batting collapse in the second Test against South Africa in Johannesburg.
The visitors had reached 174 without loss and were only four down at tea before a determined fightback by the home side at The Wanderers left the game finely poised with the tourists needing a win to level the two-match series.
Hughes and Watson had put on a century partnership but both went short of their own centuries, each falling for 88.
Australia also lost former captain Ricky Ponting, for a duck, and Michael Clarke (11) to reach tea on 220-4 to trail South Africa’s first innings by 46 runs.
Hughes was caught at first slip by AB de Villiers off Vernon Philander, trying to drive a good length delivery off the back foot but the ball took the outside edge to leave Australia on 174-1.
Jacques Kallis then took the attack to Australia with some full deliveries which attempted to keep Watson and Usman Khawaja on the defensive.
Kallis was rewarded when he claimed the wicket of Watson for 88 with the total on 192.
Watson hooked Kallis but was caught by Imran Tahir who dived to his right to take a two-handed catch.
Ponting was out for a duck when he was trapped lbw by Dale Steyn and Clarke lost his wicket after scoring a patient 11 off 33 balls, caught by De Villiers at first slip off a rising delivery from Morne Morkel, leaving the tourists on 211-4.
Khawaja (12no) and Mike Hussey (8no) then took the tourists to 220 without further loss at tea.
Hussey had made 12 when Morkel found the outside edge of a forward defensive but the ball dropped short of De Villers at slip.
Khawaja had taken 57 balls to score just 12, leaving the tourists 228-5. When Hussey was out for 20, bowled after playing around a straight delivery from Steyn, Australia were 233-6 and in danger of not matching South Africa’s total.
Brad Haddin had an escape when he top-edged a ball from Steyn over the slips and the next ball just failed to find the outside edge.
Haddin and Mitchell Johnson had put on 22 for the seventh wicket before the wicketkeeper was lbw to Tahir for 16 as the visitors still trailed by 11.
Tahir bowled Peter Siddle without scoring four balls later as Australia lost four wickets for 35 runs in 11 overs after tea.
Pat Cummins added two before Steyn found his outside edge and Mark Boucher dived full length to his right to take a two-handed catch, leaving the tourists on 285-9.
Nathan Lyon was dropped on two at cover by a substitute fielder who juggled a regulation catch to the ground with the total on 295.
But Tahir finished off the innings one run later when he had Lyon lbw. Australia made 296 for a lead of 30 with bowler Mitchell Johnson contributing a valuable 38 not out.
South Africa faced four balls, without scoring, before bad light stopped play.