England 269 (Pope 61*) and 391 for 8 (Sibley 133, Root 61, Stokes 72) beat South Africa 223 (Elgar 88, van der Dussen 68, Anderson 5-40) and 248 (Malan 84, de Kock 50) by 189 runs
Ben Stokes took three late wickets to seal a dramatic final-day victory for England at Newlands to level their series against South Africa at 1-1.
Stubborn resistance from Pieter Malan, Quinton de Kock and Rassie van der Dussen had taken South Africa into the tea interval five wickets down, with the pitch offering little for England's attack and the draw looking ever more likely.
But after Joe Denly removed de Kock and what initially seemed to be an inspired piece of captaincy from Joe Root accounted for van der Dussen, Stokes burst through the tail in the final hour to complete a 189-run win with only 8.2 overs to spare.
De Kock had put on 66 off 203 balls alongside the valiant van der Dussen to see South Africa through to tea, and with James Anderson absent throughout the session - seemingly with a side injury - England's chances had appeared to have faded.
That was, at least, until Denly, the part-time legspinner, broke the stand with one of his worst deliveries of the match. Having dismissed Dean Elgar the previous evening, Denly had caused de Kock - another left-hander - problems by landing the ball in the rough outside the off stump. Faced instead with a rank long-hop, de Kock looked to free the shackles by pulling off the back foot, but only managed to find Zak Crawley at short midwicket.
It looked like inspired captaincy had brought the seventh wicket. Root, who appeared to have grown increasingly frustrated with his side's inability to take a wicket, moved Anderson from silly mid-on and into the leg gully position where Stokes had caught Steve Smith in the final Ashes Test last year off Stuart Broad's bowling. The following ball, Broad slid a full delivery down the leg side, which van der Dussen tickled round the corner straight to the gleeful Anderson. Root later gave credit for the field placement to Broad, who admitted that he had missed his line, rather than pulling off a masterful plan, but England's fans celebrated all the same.
Dwaine Pretorius joined Vernon Philander with runs an irrelevance, as South Africa moved into the final hour with three wickets intact. Stokes, with relentless energy, continued to bound in and push 90mph, and after three near misses in an over, Pretorius eventually departed. Hitting a hard length in the off-stump channel, forcing the batsman to play, Stokes drew the edge as Pretorius steered to Root at slip.
Anrich Nortje, who had proved such a frustration to England at Centurion, was the new man in, and Stokes could be seen repeating "same ball, same ball" to himself at the top of his mark. His note-to-self worked a treat: not only was it the same ball, but the same result, as Nortje pushed with hard hands at a back-of-a-length delivery and Crawley held a juggling catch at third slip, initially palming it up with his right hand before snaffling the second chance with his left while prone on the turf.
Philander was left to bat out 12.2 overs with only Kagiso Rabada for company, and looked to nullify Dom Bess with a handful of attacking strokes despite men surrounding the bat. Rabada, usually a poor player of spin, kept Bess out, playing with soft hands to dig out anything tossed up on the stumps.
But Stokes made the breakthrough with 50 balls left in the day, firing in a back-of-a-length ball that bounced sharply off the pitch, struck Philander's glove and skewed up to Ollie Pope in the gully. Yet again, England's talisman had risen to the occasion.
England had hoped for an early breakthrough after removing Zubayr Hamza late in the piece on the fourth evening, and Anderson struck in the third over of the day, trapping Keshav Maharaj plumb in front to the extent that the nightwatchman had started to walk before being given out. He had looked in trouble against Anderson from the outset, even having his bat snapped in two in the day's first over by an inswinger that hit the splice.
Anderson could have had another soon after, when his booming inswinger struck Faf du Plessis' pad before the bat, skewing into the leg side and almost causing him to be run out coming back for the second. England had barely appealed after hearing two noises, but UltraEdge confirmed it had hit pad first and would have gone on to smash into leg stump.
Stokes - regularly touching the 90mph/145kph mark - and Bess continued to keep South Africa honest, as Pieter Malan maintained his measured innings by leaving and defending with composure, but du Plessis decided to try and free the shackles soon before the new ball and picked out Denly at square leg.
Perhaps surprisingly, Sam Curran took the second new ball, but Root's gamble was vindicated as he struck to end Malan's resistance. Bowling a tight line across the right-hander from over the wicket, Curran enticed a defensive prod to a back-of-a-length ball which took the edge and flew into the grateful hands of Stokes at second slip for his sixth catch of the match.
That brought van der Dussen and de Kock together, who looked set to seal a draw for South Africa having taken them through to tea with five wickets still remaining. But not for the first time, it was Stokes who would have the final say.