Ricky Ponting scored an unbeaten half-century on Sunday to keep alive Australia's hopes of salvaging the series against South Africa on the fourth day of the second and final test at the Wanderers.
Ponting, desperate for runs to save his international career after scoring just 245 in 15 innings in the last year, finished the penultimate day on 54 not out, steering Australia to 142 for three.
Bad light stopped play 25 minutes before the scheduled close with Australia requiring another 168 runs to win and level the series.
Usman Khawaja announced his arrival on the international stage by scoring a determined 65 and shared a crucial third-wicket stand of 122 with Ponting.
"We've got ourselves in a brilliant position, it's been a great day for us. The test is in the balance, but we're in the box seats. Ricky looks pretty settled and it should be a very exciting final day," 18-year-old Australian fast bowler Pat Cummins told a news conference.
Elder statesman Ponting and rookie Khawaja steered Australia through a difficult period in the hour before tea, coming together with the score on 19 for two in the third over.
Khawaja batted for almost three hours, facing 110 balls and stroking eight fours and a six. The 24-year-old was strong on the hook shot and it was the leg-spin of fellow Pakistan-born player Imran Tahir that eventually ended the partnership.
Khawaja edged a googly that spun across him to Jacques Kallis at slip. His dismissal brought Australian captain Michael Clarke to the crease for just one ball before bad light intervened.
Seamer Vernon Philander rocked Australia as they started their fourth-innings run-chase, taking two quick wickets to leave them reeling on 19-2.
At that stage overhauling the 310-run victory target seemed to be an impossible task for the Australians but Ponting and Khawaja dug their heels in to frustrate the hosts.
More on Sports
The visitors are chasing the highest winning score in a test at the Wanderers, but would have been faced with an ever bigger target if Cummins had not produced an impressive burst after lunch.
South Africa resumed on 314 for seven, Philander and Dale Steyn having added 48 for the eighth wicket, but were disappointed to lose Philander for 23 off the first ball of the second session.
Cummins produced a vicious bouncer which brushed Philander's glove before going through to wicketkeeper Brad Haddin. Umpire Billy Bowden gave the batsman out after a long delay, with Philander asking for a review before the decision was confirmed.
Cummins then fired in an impressive yorker to bowl Morne Morkel first ball, before Steyn unleashed some terrific late hitting to collect three sixes, his innings of 41 lifting South Africa's total to 339.
The 18-year-old Cummins eventually had Steyn caught behind to finish with six for 79 on debut.
The Australian second innings had a dramatic start as Shane Watson (naught) withdrew his bat from the second delivery and was bowled by Philander, who swung the ball away before getting it to nip back off the pitch.
Phil Hughes scored 11 before he pushed hard off the back foot at a Philander delivery that bounced more than expected outside off stump, edging a catch to Kallis at second slip.
Earlier Hashim Amla (105) notched up his 14th test century in the 10th over of the morning as he wristily dabbed Peter Siddle through gully for his 14th four.
Amla's 5-1/2 hour innings ended when he edged a fine delivery from left-arm paceman Mitchell Johnson that bounced and seamed across him to wicketkeeper Haddin.
"It's evenly balanced but I'd rather be in our dressing room than their's because we got a big boost with a wicket late in the day and if we get an early wicket tomorrow morning, then we'll have them under a lot of pressure," Amla said.
"It's not an easy pitch to bat on and it does more in the morning, so the first session will be quite crucial for us Monday."
Australia are 1-0 down in the series and have to win this test to avoid their first series defeat in South Africa since 1970.