Pakistan leveled the one-day series at 2-2 with an eight-wicket walloping of South Africa with 111 balls to spare on Sunday, leaving the teams facing a deciding final game in Cape Town next week.
Pakistan overtook South Africa's 164 all out with ease, with opener Imam-ul-Haq leading the chase with 71 to follow up on his century in the third game.
Fakhar Zaman made 44 in their opening stand of 70 and Babar Azam then joined Imam for a 94-run partnership for the second wicket. Pakistan cruised to 168-2.
Imam was out one ball before Pakistan clinched victory. Mohammad Rizwan, in the team in place of banned captain Sarfraz Ahmed, hit the winning runs by cutting a four away through point first ball he faced.
Pakistan won with more than 18 overs to spare and held its concentration for a convincing victory on the same day it was confirmed captain Sarfraz had been banned for four games for a racist taunt aimed at South Africa allrounder Andile Phehlukwayo in the second ODI.
Left-arm seam bowler Usman Shinwari set up Pakistan's victory with his 4-35 after being recalled to the team.