David Miller's electric knock and some excellent death bowling ensured Babar Azam's 90 was in vain as South Africa sealed a T20-series victory over Pakistan with a thrilling seven-run win.
Stand-in captain Miller, Man of the Match in the first encounter after a starring role in the field, whacked 65 off 29 balls to guide the Proteas to an imposing 188-3 in Johannesburg.
It appeared as though Pakistan would coast to that total with Babar stroking the ball around for fun as part of a fine 102-run stand with Hussain Talat (55).
But the excellent Beuran Hendricks took the crucial wicket of Babar to leave Pakistan 147-2 in the 17th over before Andile Phehlukwayo (3-36) and Chris Morris (2-36) caught the tourist's middle order cold.
Asif Ali (2), Shoaib Malik (6), Imad Wasim (6) and Hasan Ali (1) all fell as part of Pakistan losing six wickets for 34 runs in the final 24 balls to finish on 181-7, leaving them 2-0 down in the three-match series.
Debutant Janneman Malan and Reeza Hendricks put on 58 for South Africa's first wicket, the former smacking three fours and a couple of sixes before Imad – who in his previous over had bowled a maiden – tossed up a slower one that led to a stumping.
Rassie van der Dussen put on a rapid 45 off 27 after Reeza Hendricks had been run out for 28, before it became the Miller show.
The stand-in captain hit two huge sixes off Hasan Ali and went after the luckless Usman Shinwari (0-63) in the last over, scoring 29 runs in a dazzling blitz.
Babar set out his stall early with six boundaries in Pakisan's first two overs and, even after Fakhar Zaman (14) fell, he continued to pile on the runs with Talat allowing him to dominate the strike.
South Africa was looking devoid of ideas and when Talat walloped Morris over midwicket to bring up the century stand it appeared as though a series decider would be on the cards.
But when Babar failed to get enough on Beuran Hendricks' (2-30) slower ball that carried to midwicket, Pakistan completely wilted.
Asif pulled a short Phehlukwayo delivery straight to Reeza Hendricks at midwicket, before Morris bowled Talat and Imad in the penultimate over.
Pakistan needed 15 off the last and a four from Shoaib gave them brief hope.
But Phehlukwayo sent Shoaib and Hasan packing as South Africa completed a dramatic series win with a match to spare.
It means South Africa can now celebrate victory across all three formats in a tour that started on Boxing Day.