Draw ensues after dice with danger
England 425 (Pietersen 149, Prior 68) and 130 for 4 drew with South Africa 419 (Petersen 182, Smith 52) and 258 for 9 dec (Rudolph 69, Smith 52, Broad 5-69)
Scorecard and ball-by-ball details
A Headingley Test that had been marked throughout by cautious, disciplined cricket in morose weather ended with an unexpected and deeply uncomfortable England run chase as South Africa's captain, Graeme Smith, with the happy daring of a man who had recently witnessed the birth of his first child, set them 253 from 39 overs to level the series at 1-1 with one to play.
England's chase, which turned abruptly into a battle for survival at 106 for 4 with 19.2 overs remaining, was cagey but not entirely artificial as they responded in kind. Kevin Pietersen accepted the role of gung-ho opener - the first time he had opened for England in Test cricket - and struck three boundaries off Morne Morkel's first over before he spliced to mid-on. Matt Prior also came in at No. 5 shortly before England reached the final hour with 154 needed off 20. Then Prior was run out by Smith, of all people, from behind square as Jonathan Trott procrastinated over a second run.
The presence of Andrew Strauss and Trott in the top four summed up the double think in England's batting order; both would have been better reserved for calamity. It was a run chase England were obliged to flirt with, having lost the first Test in the series, but knew that the odds were they would end up blocking out.
Smith then, with the game safe, delayed a while before he dared to attack in force and called things off at 130 for 4 with six overs remaining - the equivalent of two sessions lost to rain had had the final say. The pressures of Test captaincy hang heavily. But both sides deserve credit for dicing with danger and both will claim a psychological advantage. What is beyond debate is that we have two sides entering the final Test at Lord's with appetites whetted. Why, oh why, is this a three-Test series?
If Pietersen's exhilarating century on the third day had first brought the Test alive, it was a more improbable achievement - three South Africa wickets on either side of lunch - that enlivened it again. But his biggest impact came after the match as he warned that his stand-off with the ECB was on the verge of bringing his England career to an end.
It certainly revitalised Stuart Broad, who is looking more and more a mood player these days, and who responded to a shift in the game with a five-wicket spell broken by tea, including a rush of four wickets in 20 balls as the sun broke through and an excellent Headingley pitch finally began to show signs of wear.
Broad, bowling full and straight, removed AB de Villiers, who had played regally for 44 from 45 balls, and JP Duminy with successive deliveries. Duminy got his feet in a tangle as he was dismissed first ball; Vernon Philander soon followed.
Then as tea approached, Broad made it four as he banged the ball in short at Jacques Kallis and brushed his glove to claim a wicketkeeper's catch as Kallis limbo danced in self-preservation. Alviro Petersen was also pressed into service despite a damaged hamstring that prevented him running with comfort. His last wicket, a slog by Morkel, was followed by Smith's declaration. And until recently his captaincy was held to be ultra conservative.
South Africa had begun the final day with a lead of 33 and crucially their opening pair survived until the last over before lunch, at which point, frustratingly for Jacques Rudolph, he was again immediately overcome by Pietersen's lightly regarded offspin. Pietersen had Rudolph stumped in his first over on the second day, and this time he had him lbw in his first over on the final day. On both occasions, the ball turned sharply.
Rudolph, the more skittish of the pair, released a few neat off-side drives but never looking content against the short ball. Several deliveries, against Anderson in particular, scudded through the slips, and he also took another blow on the shoulder as a short ball from Anderson forced him into evasive action.
As Pietersen assembled his best Test figures, Graeme Swann, whose offspin was omitted as England opted for an all-pace attack, was preparing to join Nottinghamshire for a Championship match at Taunton. The conclusion that England had erred in selection could not easily be avoided - although Pietersen's final wicket, a loopy full toss which Hashim Amla drilled to short extra, hardly ranked as evidence.
Pietersen also uprooted Smith, whose battling half-century, which was reached from the last ball of a morning session, extended to two-and-a-half hours and was interrupted by two rain stoppages, had made Headingley's first draw in 13 Tests all but inevitable.
Pietersen had thought he had Smith caught at the wicket only to waste a DRS appeal finding out he hadn't. But Smith fell in Pietersen's next over, this time the South Africa captain failing with a review after an ungainly sweep was caught by James Taylor at short leg. Umpire Steve Davis was perhaps fortunate that the TV umpire, Asad Rauf, did not overturn his decision.
Smith looked embattled. The look suited him, as it always does. It was a grouchy morning, with showers scudding across the outfield at regular intervals, his knee was strapped to try to combat a dicey cartilage and he had a Test match to save. As events subsequently suggested, it was not as straightforward as many supposed.
Smith had a let-off in the penultimate over before lunch when he edged Tim Bresnan, but was dropped one-handed by Anderson, diving to his right at second slip. Anderson later waved past de Villers' edge against Pietersen. He is England's best slip fielder, but there is a malaise at present in their close catching.
That escape apart, Smith was in his element. He has built a formidable Test record - more than 8,000 runs at an average over 50 - by grimacing and deflecting, working the leg side with an angled blade and putting his considerable bulk on the line to great effect. His record against England is a special one.
For all his inelegance, he is a special breed of cricketer. He defended his wicket with the resolve and physical presence of a Greco-Roman wrestler imagining he was fighting himself.
England attacked him predictably, with their routine two-slips-and-a-gully and run savers on the leg side. With quick wickets imperative, on this occasion at least, the lack of a leg-side catcher verged on the negligent. But England are committed to their disciplines and by the time they played fast and loose with Pietersen and Broad it was too late.
David Hopps is the UK editor of ESPNcricinfo