Mohammad Yousuf struck a century as Pakistan levelled the one-day series against South Africa at 1-1 with a 25-run victory on Saturday.
Yousuf made 117 from 143 balls - passing 8,000 one-day international runs in the process - to allow the hosts to reach 265-9 after opting to bat first at the Gaddafi Stadium in Lahore.
Graeme Smith led his side's reply with 65, but Umar Gul and Iftikhar Anjum each took three wickets as South Africa were bowled out for 240 in 49.3 overs.
South Africa's run chase began badly when Herschelle Gibbs was trapped lbw by Umar Gul from the the third ball of the innings.
And Jacques Kallis then edged to second slip in Sohail Tanvir's opening over as the Proteas slumped to 4-2.
Opening batsman Smith shared a third-wicket stand of 76 with Abraham de Villiers to repair that early damage.
De Villiers reached 35 before being bowled by Anjum, and six overs later Justin Kemp fell lbw to the same bowler to leave South Africa at 94-4.
The tourists' hopes now rested on the shoulders of Smith, who took advantage of being dropped three times to reach his half-century from 71 balls.
Mark Boucher gave Shahid Afridi a return catch after contributing 14, and Abdur Rehman then made the decisive breakthrough by having Smith caught behind for 65.
Shaun Pollock (37) and Albie Morkel (31) both contributed battling knocks down the order, but South Africa were eventually bowled out for 240 from the third ball of the final over.
Earlier, Pakistan had also made a poor start to their innings, slumping to 13-2 in the sixth over with both openers - Kamran Akmal (0) and Imran Nazir (2) - back in the pavilion.
But Yousuf shared stands worth 60 with Younis Khan and 107 with Shoaib Malik for the third and fourth wickets respectively to pave the way for a respectable total.
Younis contributed 32 before being run out, while captain Shoaib struck four sixes during an innings of 56 from 52 balls - his 23rd one-day intenational half-century.
Shoaib's dismissal, caught by Justin Kemp off the bowling of Charl Langeveldt (2-47), left Pakistan at 180-4 with 12.1 overs remaining.
Yousuf continued to accumulate runs in untroubled fashion, reaching his13th one-day international century from 129 balls.
The experienced right-hander eventually departed for 117 in the penultimate over - bowled by Morkel (2-43) - as Pakistan closed at 265-9.
South Africa won the series opener by 45 runs last Thursday, meaning the five-match series is level at 1-1 ahead of the third instalment in Faisalabad on Tuesday.