South Africa wrapped up a 2-0 Investec series victory over England after the hosts went down by 51 runs on a thrilling final day at Lord's.
Chasing a record 346 to win and tie the three-match series with openers Andrew Strauss and Alastair Cook already out, England gave the tourists a fright before being bowled out for 294.
Jonathan Trott, Jonny Bairstow and Matt Prior all struck half-centuries as England gradually closed on their victory target into the late afternoon.
When Trott (63) was sixth man out with the score on 146 it looked as though England would submit meekly, but Prior (73) along with Stuart Broad and Graeme Swann would have none of it.
The trio lashed the ball to all parts of the ground before Broad skied one, Swann was run out and Prior succumbed to the second new ball.
It meant South Africa deservedly took their place at the top of the Test rankings after dominating large periods of the series, with England dropping to second in the table.
An England win was highly improbable on the final morning, resuming on 16-2 after man-of-the-match Vernon Philander (5-30) had removed Strauss and Cook the previous evening.
Ian Bell soon succumbed when Philander had him edging to a juggling Graeme Smith at first slip. Trott had a charmed life with a series of early plays and misses against Philander and Morne Morkel.
But Trott registered England's first boundary, an edge high over the slips off Philander, from the first ball of the 17th over.
He was joined by Taylor, who came through the remainder of Philander's spell unscathed only to be run-out when Trott clipped Steyn to wide long-on and then sent his partner back for an attempted fourth run.
The breakdown in communication left Taylor with no chance to retrieve his ground as the ball was ferried in from the deep.
Had Jacques Rudolph clung on to a half-chance, high to his right at third slip off Kallis, Trott would have gone for 33 and England would have been 57-5.
Instead, Bairstow - after his first-innings 95 - again injected youthful intent as he and Trott took England past lunch.
They bagged some boundaries too, Bairstow under way with a rush of four from eight deliveries off Steyn and then taking two from the first two balls he received at the start of Imran Tahir's spell - clubbing the leg-spinner down the ground and sweeping him fine.
Trott had time just before lunch to complete his near three-hour 50 when he nudged Tahir into the off-side for a scampered two, and Bairstow passed his half-century from only 41 balls - clipping Philander fine for his eighth four.
England needed much more of the same, though, and did not get it from Bairstow - who went fatally back to Tahir and was bowled by a leg-break that kept low.
Steyn then returned from the pavilion end and, with his very first delivery, produced a beauty to have Trott very well-caught high to his left at second slip by Kallis.
And at 146-6, England seemed sure to fall well short and therefore concede their world number one status to the tourists. However, that was reckoning without Broad (37) and Prior, who responded with a stand of 62 in England's teatime 221-7.
Broad strode out with licence to thrill and did so with some adventurous strokeplay, including a six pulled over square-leg off South Africa's pace spearhead Dale Steyn.
Yet when Broad mis-hooked a Jacques Kallis bouncer down to long-leg, where Hashim Amla set himself to complete a low catch, England were surely running out of batsmen.
Swann took over where Broad had left off though, smoking 41 from only 34 balls in a 74-run partnership that took England to 282 and in full sight of a remarkable win.
However, Swann was run out after answering Prior's call for a quick single and although Prior had a life when he was caught off a Morkel no-ball, while also surviving a narrow stumping appeal, South Africa were again firm favourites.
The second new ball would be key and so it proved, Prior chasing another outswinger from Philander that was well held down low by Smith at first slip, the England wicket-keeper top-scoring with 73.
Last man Steven Finn lasted just one ball, knicking Philander to Kallis at second slip to spark wild celebrations from the fielding side.