Opening batsman Quinton de Kock launched an assault on Pakistan's bowlers to set up a series-clinching win for South Africa in the fifth and final one-day international at Newlands on Wednesday.
De Kock slammed 83 off 58 balls as South Africa chased down a target of 241 with seven wickets and ten overs to spare to seal a 3-2 series win.
"Quinny made it easy for the rest of the batters," said South African captain Faf du Plessis, who said he was "extremely happy" with the way his team had played.
"Our best performance came tonight in a crunch game," said Du Plessis. "The bowling was excellent and the fielding was really good. And when Quinny plays like he did tonight he's extremely difficult to bowl to."
While man-of-the-match De Kock sealed the win with his dazzling strokeplay, South Africa's bowlers played a significant role by restricting Pakistan to 240 for eight despite an aggressive 70 by Fakhar Zaman.
While Zaman was at the crease, Pakistan were on course for a big total. He was fourth out after a 73-ball innings when the total was 128 in the 25th over. But the scoring rate slowed after his dismissal, with only 49 runs scored in the next 15 overs.
"Our top three batters got starts and we wanted them to capitalise," said Pakistan stand-in captain Shoaib Malik, who has temporarily taken the role from Sarfraz Ahmed after the wicketkeeper was banned for making a racist remark about Andile Phehlukwayo.
"White-ball cricket is all about the first three batters."
Malik congratulated opening batsman Imam-ul-Haq, who was named man of the series after scoring 271 runs at an average of 54.20 in five innings. "He is improving day by day," said Malik.
Pakistan improving ahead of World Cup
Malik said he believed Pakistan were making good progress ahead of the World Cup in England and Wales, which starts on May 30.
"A good sign for Pakistan cricket is that we are fighting to the last ball. We are going forward."
Imad Wasim, batting at number eight, gave the innings late impetus, hitting 47 not out off 31 balls. He struck sixes off Dale Steyn and Kagiso Rabada in the last two overs.
Medium-paced all-rounders Dwaine Pretorius and Phehlukwayo both took two wickets in a disciplined South African bowling performance.
The left-handed Zaman hit ten fours in making his first half-century after a sequence of low scores in both the Tests and the ODIs.
He was dropped on 20 when he slashed Rabada to Hashim Amla, who could not hold a sharp, chest-high chance.
Fellow left-hander De Kock went for his shots from the start of South Africa's innings and had a let-off in the third over with his score on 12 when a mis-hit against Usman Shinwari looped to cover.
But after asking for a replay, umpire Gregory Brathwaite no-balled Shinwari for overstepping.
De Kock went on to hit 11 fours and three sixes before he was again caught off Shinwari, this time off a legal delivery, with substitute Hasan Ali taking a good running catch at deep midwicket.
With the required rate reduced to less than three an over, Du Plessis and Rassie van der Dussen were untroubled in an unbeaten fourth-wicket partnership of 95, with both batsmen hitting half-centuries. Van der Dussen finished the match by hitting a straight six off leg-spinner Shadab Khan.
All five matches in the series were won by the side batting second.