AB de Villiers completed a century as South Africa made 409 all out on the second day of the third and final Test against Pakistan at SuperSport Park on Saturday.
Pakistan were nine for no wicket at lunch.
De Villiers, resuming on 98, reached his 16th Test century - and his third against Pakistan - when he eased Rahat Ali through the covers for three runs in the second over of the morning.
He went on to make 121 before being caught in the deep off left-arm opening bowler Rahat Ali, who finished with six for 127.
Rahat earlier dropped a straightforward catch at fine leg when De Villiers, on 107, top-edged a pull against Mohammad Irfan, who was the most challenging of an inexperienced pace trio but ended wicketkless.
Vernon Philander made a Test best score of 74 in helping De Villiers stretch their overnight partnership of 86 to 129 - a record seventh wicket stand for South Africa against Pakistan - before he was caught low down at first slip by Mohammad Hafeez off part-time bowler Younis Khan.
Pakistan were without Ehsan Adil, who suffered a calf injury on Friday.
De Villiers made his runs off 215 balls with 15 fours, while Philander faced 113 balls and hit nine boundaries.
Rahat bowled a mixture of wicket-taking deliveries with some poorly directed balls, conceding close to five runs an over. His analysis included six no-balls and six wides.