Teenager Pat Cummins followed up his six-wicket haul with the winning boundary as Australia secured a drawn series against South Africa by taking victory in a frantic finish in Johannesburg.
The 18-year-old was a hero with the ball earlier in the match and today came in with Australia wobbling on 292 for eight, still needing another 18 runs.
He rode his luck, offering Dale Steyn a caught-and-bowled chance, before pulling the match-deciding four off Imran Tahir.
At the other end, Mitchell Johnson finished unbeaten on 40, while Brad Haddin's 55 and 39 from Mike Hussey had earlier helped nudge Australia towards their target of 310.
Australia lost the opener in the two-match series by eight wickets in Cape Town, but today seized their chance to make up for that disappointment.
Cummins could hardly have made a more spectacular debut, and was named man of the match for his achievements.
"Just to get a Test match is unbelievable. Obviously this is a great win today," Cummins said at the presentation ceremony, televised by Sky Sports. "We came from behind and this just tops it off.
"It was great to bowl them out yesterday and to contribute was even better."
He bowled tidily in South Africa's first innings before ripping through their batting line-up when the home side batted next, rooting out six batsmen.
The New South Wales paceman has no batting pedigree to speak of but did not let that unsettle him when Peter Siddle's tame dismissal brought him to the middle this afternoon.
Johnson looked secure, so that may have eased his nerves, but the inexperience of Cummins versus the seasoned professionals in South Africa's attack looked like a no-contest.
Steyn got half a hand to the chance Cummins offered him, but the ball rolled away for four, and the tourists continued to whittle away the runs required.
With five still needed, South Africa skipper Graeme Smith brought Tahir back into the attack, rather than keeping faith with Vernon Philander, who had innings figures of five for 70 and was later named man of the series.
The audacious move almost paid off three balls in when off-spinner Tahir thought he had Cummins lbw. South Africa used a review to challenge the not-out verdict, but without any joy.
Cummins left the next ball, which sneaked past his off stump, before crunching the fifth of the over away through midwicket to the boundary. He finished unbeaten on 13 from 15 balls.
"I was a little bit nervous when I came in at the end. I just tried to swing as hard as I could," Cummins said.
Australia had been 142 for three overnight, a position which gave both teams cause for optimism, but a washed-out morning session meant they were kept waiting.
The Australians lost captain Michael Clarke for just two, bowled by Philander, and resistance from Ricky Ponting came to an end on 62 when he slashed a menacing delivery from Morne Morkel to Jacques Rudolph at slip.
Philander pinned Hussey lbw, and at 215 for six the tourists were in trouble, with their hopes seemingly resting on Haddin and Johnson, the tail looking brittle.
Their partnership had reached 72 when Haddin got a thin edge to an away-swinging delivery from Philander, Mark Boucher pouching the catch.
Siddle then chipped Steyn to Tahir with the team total on 292, and South Africa were again looking favourites.
They could not dislodge Johnson or Cummins though.
Proud Australia captain Clarke explained he was "yelling like an absolute goose" in the final stages of the match, but said: "I couldn't be happier with the result."
Clarke could not fail to be impressed by the newest Australian cap, saying of Cummins: "He's a hell of a talent.
"It's not just opposition players, but the Aussie guys know how good he is.
"It is about now managing Cummins and making sure he becomes one of the all-time greats."
Home skipper Smith, reflecting on the series, said: "We both threw a lot of punches and we've ended up level again.
"I must give credit to Australia today, to chase 310 a few of their guys stepped up and performed really well."
Johannesburg Australia beat South Africa by 2 wkts
South Africa 266 (A B de Villiers 64, J H Kallis 54,
A G Prince 50) and 339 (H M Amla 105, A B de Villiers 73; P J
Australia 296 (P J Hughes 88, S R Watson 88; D W
Steyn 4-64) and 142-3 (U T Khawaja 65, R T Ponting 54 no).
Australia Second Innings
R T Ponting c Rudolph b M Morkel 62
M J Clarke b Philander 2
M E K Hussey lbw b Philander 39
B J Haddin c Boucher b Philander 55
M G Johnson not out 40
P M Siddle c Imran Tahir b Steyn 4
P J Cummins not out 13
Extras b1 lb7 w4 nb7 pens 0 19
Total 8 wkts (86.5 overs) 310
Fall: 1-0 2-19 3-141 4-145 5-165 6-215 7-287 8-292
Did Not Bat: N M Lyon.
Bowling: Philander 20 3 70 5
Steyn 23 1 98 1
M Morkel 19 6 43 1
Imran Tahir 15.5 0 63 1
Kallis 9 1 28 0