South Africa 126 for 2 (Malan 63*) and 223 require 312 more runs to beat England 269 and 391 for 8 dec (Sibley 133*, Root 61, Stokes 72)
Mark Boucher encouraged his South Africa side to channel the spirit of the 2008 Perth Test last night, and Pieter Malan's battling, unbeaten 63 left them dreaming of an improbable escape on the fourth evening of the Newlands Test despite James Anderson's late wicket.
After England looked to hammer their advantage home in the day's first session, with Dom Sibley completing his maiden Test hundred and Ben Stokes clubbing 72 off only 47 balls, South African heads began to drop with the lead soaring past 400.
But after the declaration came 20 minutes after lunch, Malan and Dean Elgar were resolute, leaving the ball well and blunting England's attack on a pitch that looked to possess few demons by the close. Elgar fell for 34 after struggling against the part-time legspin of Joe Denly, but Malan put on 52 with Zubayr Hamza to push South Africa towards the close before Anderson coaxed an edge out of Hamza to give England a vital breakthrough.
That wicket left South Africa needing 312 more runs on the final day. If that target seemed a tall order, then the fact that conditions have become increasingly favourable for batting suggests that a draw is by no means impossible.
After Dom Bess's dismissal to the final ball of the third day, Stokes wasted little time in signalling England's attacking intentions in the morning session. He bludgeoned the eighth delivery he faced to the midwicket boundary off Dwaine Pretorius, and hit the same bowler for six down the ground and through third man with a delicate reverse-lap in consecutive balls at the start of his next over.
Unexpectedly, Faf du Plessis had declined to take the new ball as soon as it became available, instead hoping that Keshav Maharaj might lull Stokes into a false stroke. Stokes took the bait, ripping it clean off while avoiding the hook as he deposited him over midwicket for six.
The new ball then came, but Stokes showed no signs of slowing down as Vernon Philander's 14th over of the innings went for as many runs (12) as his previous 13 combined. Kagiso Rabada fared little better, and at one stage, Stokes was on 38 off 26 balls at the same time that the unmoved Sibley had added only three from the 31 deliveries he had faced.
After edging through the vacant third-slip area for four, Sibley nailed a sweep shot off Maharaj to bring up his maiden Test hundred, the first by an England opener at Newlands since Jack Hobbs in 1910. He began to move through the gears himself, perhaps inspired by the carnage unfolding at the other end as Stokes smote four, six, four off three Maharaj balls to move to 70 from 42.
But he was soon to go, slapping the left-arm spinner to Rassie van der Dussen at long-on after 75 destructive minutes to start the day. Ollie Pope dragged on while looking to force the ball through the off side before Jos Buttler edged the unwell Anrich Nortje through to Quinton de Kock while scooping, and Sam Curran picked out Hamza at midwicket three balls after lunch.
Sibley, however, stuck to his task, hitting a rare six and reverse-sweeping four more off Maharaj, before Joe Root decided he had seen enough and called his men in with 438 the target.
Malan and Elgar started watchfully, showing good judgement in leaving the ball and looking to score when England erred from their lengths. England thought they had made the breakthrough only ten balls into the innings, as Stuart Broad rapped Malan on the pad, but Kumar Dharmasena shook his head and was proved right when Ultra-Edge revealed a large spike as the ball passed the inside edge following England's review.
Root turned to spin early in the piece, bringing Bess on to bowl the ninth over of the innings, but it was not until Denly's introduction immediately before tea that Elgar looked particularly troubled.
Perhaps by a quirk of fate, Elgar had only faced 106 balls of legspin in his Test career before this game, despite playing as many as 104 innings, and he immediately struggled to read Denly's legbreaks, which turned and bounced appreciably out of the rough. He survived until the interval after being struck on the thumb, but then feathered an edge through to Buttler when lunging forward in defence to give England the breakthrough.
Elgar reviewed Paul Reiffel's decision almost immediately, but Ultra-Edge suggested he had got the faintest of scratches on the ball, enough evidence for the on-field decision to be upheld, and he was left to rue what he perceived to be his misfortune.
It seemed like a big moment, with Hamza struggling against Broad throughout the series - the No. 3 had been dismissed by him in all three innings - and South Africa's first fifty stand for the first wicket in 17 Test innings coming to an end. But despite both batsmen taking regular body blows, and Malan in particular leaving several deliveries that seemed almost certain to hit the top of his off stump, South Africa were set to survive until the close.
But Anderson re-wrote the script's finale, after finding a fraction of reverse swing late in the day. After shaping the ball in towards Malan in the first over of his final spell, the second ball of Anderson's next over nibbled away off the seam, finding the outside edge as Hamza pushed at the ball expecting it to come back in. It was Anderson's 92nd wicket against South Africa, taking him past Shaun Pollock (91) as the leading wicket-taker in England-South Africa Tests.
It seemed as though Malan in particular would prove a tricky man for England to dismiss: as Boucher had hoped, he was positive in using his feet against the spinners, and survived a short-ball barrage from Stokes in the final session to make it to stumps unscathed. While victory seems highly improbable, South Africa will be hopeful that their new opener can lead the charge towards a crucial draw.