South Africa 81 for 1 (Smith 36*, Amla 29*) and 96 (Watson 5-17, Harris 4-33) need 155 runs to beat Australia 284 (Clarke 151, Steyn 4-55) and 47 (Philander 5-15, Morkel 3-9)
Scorecard and ball-by-ball details
South Africa's batsmen were on course for a most extraordinary Test victory by stumps after Australia had contrived to be splintered for 47, and in doing so kick away a dominant position on an incomprehensible second day at Newlands.
In all, 23 wickets fell for 294 runs, 19 of them in an uninterrupted landslide of skilful bowling and abject batting between lunch and the first hour after tea.
Australia's 47 was their lowest total since 1902 and fourth lowest of all time, overshadowing the fact that South Africa had themselves been routed for a comparatively bountiful 96 in the afternoon, and left the hosts with a target of only 236 having given up a first-innings lead of 188.
Graeme Smith and Hashim Amla played with poise and power in the chase, demonstrating that the Cape Town surface was far from the treacherous strip it had appeared when the Australians batted a second time. In what must have felt to the tourists like the final insult, Amla sliced the final ball of the day to gully, where Michael Hussey dropped it.
The cascade of wickets added further lustre to a monumental 151 by the Australian captain Michael Clarke, who had shepherded the tail on the second morning to reach an ultimately handsome total of 284 from the overnight tally of 214 for 8. But he and his team will now feel aghast at how they have managed to surrender so much hard-won ground in a single innings.
After Clarke's masterclass, a staggering spell from Shane Watson, and a merely excellent one from Ryan Harris appeared to have placed the match in Australia's keeping. But they were 13 for three by tea and lost a frantic 6 for 8 on resumption.
Vernon Philander and Morne Morkel were the chief executioners for South Africa, bowling magnificently in helpful conditions, but it must be said they had plenty of help from the batsmen.
At 21 for 9, Australia were still five short of the lowest innings in Test history, but Peter Siddle and Nathan Lyon put their batting counterparts to shame with a last-wicket stand of 26. Their determination contrasted with the unbridled panic of others on a pitch that, while difficult, was never so poor as to be threatening the slimmest total in Tests.
Morkel had Phillip Hughes and Hussey edging consecutive balls either side of the break into the slip cordon. Philander swung and seamed the ball to continue the most striking of debuts, but was helped by a handful of ordinary shots from Australia's batsmen.
The worst of these was played by the wicketkeeper Brad Haddin, an ugly smear at a ball nowhere near the line or length to attack, and the rest either edged deliveries that seamed away or simply missed others that fizzed unerringly towards the stumps.
Until Siddle and Lyon came together, there was no semblance of calm shown by the visiting batsmen. Australia appeared to be unsettled significantly by the back stiffness that forced Shaun Marsh out of No. 3 in the order. He eventually shuffled to the middle at eight down, in obvious pain, and was lbw second ball.
Jacques Rudolph began neatly in the company of Smith, adding 27 before he pushed at a Siddle delivery going across him and was taken behind. It was Australia's only success in 17 overs, only one fewer than the whole of their second innings.
Such a plot twist seemed unfathomable when Watson and Harris were tearing through South Africa in the hour after lunch. Aided by a seaming pitch and alert use of the DRS, Watson and Harris orchestrated a tumble of wickets that, at the time, felt definitive. The hosts surrendered 9 wickets for 47 runs, momentarily looking as though they might fall short of the follow-on mark when 83 for 9.
Watson transformed what had previously been a quite sedate start to South Africa's innings in the first over after lunch. His second ball struck Hashim Amla in front, and the batsman was given out on referral to the third umpire. Jacques Kallis' miscalculated a pull shot off the sixth ball, that lobbed into the slips off bat and body. As with Amla, he was given out on referral to television.
A handful of overs later Watson did for Graeme Smith, knocking a seaming delivery back onto his stumps, and next ball Ashwell Prince was palpably lbw to a full delivery that swung back in. AB de Villiers fell next, bat and pad wedged closely together but adjacent, and lbw to Harris on referral. Watson had a fifth wicket inside four overs when Mark Boucher was pinned lbw on the back foot - his referral would be unsuccessful.
Vernon Philander edged to third slip, Morne Morkel was run out by Peter Siddle's direct hit while taking a haywire single - the day's only wicket not taken by a fast bowler - and after the briefest of nuisance stands, Imran Tahir was bowled by Harris.
In the morning session there had been little indication of the tumult to follow. Resuming at 214 for 8 in front of a sparse crowd, Clarke and Siddle showed the intent to score, but might both have been out inside half an hour. Philander's first ball of the day flew off the edge of Clarke's bat through second slip, but Graeme Smith hadn't posted one. Siddle had only five when Steyn found his edge towards backward point, where Tahir allowed the chance to slip completely through his fingers as he tumbled forward.
The batsmen made South Africa curse these early misses, playing with level eyes, plenty of enterprise and some luck to add 59 in all, the second highest partnership of the innings. Clarke went on to turn his century into a truly momentous score, responsible for comfortably more than half of his side's total. As it transpired, in one knock he easily scored more than what both sides would manage in the second and third innings of the match.
Eventually Siddle miscued Morkel to cover, and the last man Lyon hung around while Clarke fired off two more boundaries to pass 150. Clarke lost his leg stump when trying to swing Morkel for another, but he walked off knowing he had given his men a chance.
Marsh's place in the field was taken by the 12th man Trent Copeland, whose demotion from the XI meant Mitchell Johnson shared the new ball with Harris. There was little early movement, the sun arriving to coincide with the start of the South African innings, and after two expensive overs Johnson was withdrawn without delivering a ball to Smith, with whom he was expected to have a mini-battle.
Harris worked into a typically exacting spell. Moving the ball a little both ways, he made Rudolph use his bat, and eventually the batsman played around one that straightened the merest fraction to pluck out off stump. Amla and Smith made it through to lunch, but obliteration waited on the other side of the interval - for both sides.