Rassie van der Dussen's ton went in vain as Pakistan survived Anrich Nortje's havoc to beat South Africa by three wickets in the first ODI on Friday.
With the thrilling win, Pakistan took a 1-0 lead in the three-match ODI series.
South Africa was reduced to 55/4, but the hosts recovered courtesy David Miller's fifty and van der Dussen's hundred, and the Proteas posted 273 in the 50 overs.
However, Pakistan skipper Babar Azam' masterclass ton and gutsy knock by Mohammad Rizwan and Shadab Khan ensured the visitors don't falter in the game which saw too many twists and turns.
Chasing 274, Pakistan didn't have a good start as they lost Fakhar Zaman in the third over but skipper Babar and Imam-ul-Haq stitched a 177-run stand to revive the innings.
However, Nortje came firing on cylinders and removed three Pakistan batsmen to put South Africa in the driver's seat. The visitors collapsed 186/1 to 203/5 inside six overs.
Rizwan and Shadab then stitched a 53-run stand to lead the Pakistan chase but the visitors again crumbled as both the batsmen were dismissed in the death overs.
Moreover, Shadab's wicket came at a point when Pakistan needed three from one over. However, the visitors got over the line thanks to Faheem Ashraf who scored the three runs in the last two balls to seal a win.
The second game will be played on Sunday at The Wanderers Stadium in Johannesburg.
Brief Scores: South Africa 273/6 (Van der Dussen 123*, David Miller 50; Shaheen Afridi 2-61); Pakistan 274/7 (Babar Azam 103, Mohammad Rizwan 40; Anrich Nortje 4-51) (ANI)