Centuries by Hashim Amla and AB de Villiers set up a 34-run victory for South Africa despite a thrilling innings by Pakistan's Shahid Afridi in the third one-day international at the Wanderers Stadium on Sunday.
Amla (122) and De Villiers (128) shared a world record third wicket partnership of 238 as South Africa made 343 for five after being sent in.
Pakistan, who were bowled out for 309 to slip 2-1 down in the series, had been in deep trouble when Afridi walked in at 132 for five but he gave his side hope as he thrashed 88 off 48 balls with seven sixes and five fours.
Afridi's innings included some of the biggest sixes seen at the Wanderers.
One, after he had been bowled off a no-ball, was a mighty hit onto the roof of the four-tier Centenary stand which was last seen bouncing towards an adjacent golf course.
Afridi was yorked by Ryan McLaren when he had 73 but a check requested by umpire Billy Bowden showed the bowler had over-stepped.
McLaren then bowled a wide, which meant Afridi still had a free hit to which he committed all his power.
There was one more six before he hit a full toss from Lonwabo Tsotsobe to McLaren at long-off.
There was still a possibility of a reprieve as the umpires checked whether the full toss was above waist height, which would have meant another no-ball, before confirming the dismissal.
Amla and De Villiers batted superbly after South Africa struggled early on, with left-arm fast bowler Mohammad Irfan taking two early wickets.
They beat by one run the previous one-day international third wicket record set by Rahul Dravid and Sachin Tendulkar for India against Kenya in 1999, to ensure that Pakistan would have a challenging run chase on a ground renowned for high scoring.
De Villiers was quickly into his stride and the pair posted a fifty partnership off 38 balls.
The rate slowed slightly when Pakistan brought their spin bowlers into action.
After 35 overs the total was 115 but the runs came in a torrent towards the end of the innings. The last 15 overs yielded 156 runs.
Amla reached his 11th one-day international century off 99 balls, while De Villiers went to his 14th century in the format off 87 deliveries.
Amla was caught at cover for 122 off 113 balls with nine fours and a six and De Villiers was held at deep midwicket for 128 off 108 deliveries, with 12 fours and three sixes.
Pakistan were briefly reduced to 10 men after Irfan, who had been a doubtful starter because of a hamstring strain, left the field for treatment.
He was replaced by Umar Akmal but after 20 minutes the umpires informed Pakistan captain Misbah-ul-Haq that the maximum 20 minutes allowed for treatment had expired. Pakistan had a fielder short for two overs before Irfan returned.
Wahab Riaz conceded 93 runs in his 10 overs -- the most by a Pakistan bowler in one-day internationals. He took two wickets.