South Africa won by seven runs yesterday to take an unbeatable 3-1 lead in the seven-match series.
South Africa seemed set for a comfortable win when captain Graeme Smith hit his second century in three matches and big-hitting Justin Kemp went on the rampage as South Africa piled up 311 for seven.
Smith made 115 not out while Kemp thrashed 80 off just 50 balls with four fours and seven sixes.
England's cause looked hopeless when they needed 205 off the last 25 overs but Pietersen took them agonisingly close, reaching 100 not out when he hit the last ball of the match, a low full toss from Andre Nel, for six.
His innings took just 69 balls and he hit seven fours and four sixes.
"It was a tremendous effort by Kevin but we let them get too many in the field," said England captain Michael Vaughan.
"Graeme Smith's knock was outstanding and Justin Kemp hit the ball so hard and far it was difficult to control. When we went out to bat we made a good effort. We got within hitting range and Kevin nearly got us there with a little help from the lower order."
Smith had gone 58 matches without scoring a one-day international century until he made 105 and led South Africa to victory in the third match in Port Elizabeth last Friday.
The big left-hander made a brisk start, reaching 50 off 53 balls with five boundaries. He didn't hit another four as he went to his century off 120 deliveries.
But Smith needed do no more than rotate the strike when Kemp joined him. In an astonishing display of power batting the tall Kemp three times hit two sixes off successive balls, off Paul Collymore, Matthew Hoggard and Kabir Ali.
Kemp was aided by the boundaries being brought in some 10m because of a wet outfield caused by heavy overnight rain and a further shower in the morning, which delayed the start by an hour. But some of his sixes would have carried the longest boundaries anywhere.
South Africa's run spree exposed England's lack of bowling depth.
Only Darren Gough was able to keep the batsmen in check and he ended Kemp's innings in the 49th over with a reverse-swinging yorker. He bowled Mark Boucher with his next delivery and a third wicket fell off the next ball when Shaun Pollock was run out attempting a third run after pushing Gough past mid-off.
The onslaught was started by Smith and Jacques Kallis, who put on 90 for the second wicket off 93 balls.
Kallis hit five fours off Kabir Ali's first over. The medium-pacer was taken off immediately, came back to bowl a good spell in which he took two for 21 off seven overs, but then conceded 25 off his final over when Kemp was in full flight.
England lost both openers as they reached 61 for two in the 16th over. Vaughan made a solid 70 but it took him 94 balls and it was only when Pietersen started hitting out that South Africa had any cause for concern.