AB de Villiers hit 98 not out as South Africa reached 334-6 at stumps on the opening day of the third Test against Pakistan at Centurion.
De Villiers and Vernon Philander (45no) put on an unbroken 86 for the seventh wicket during the final 22 overs to ensure the home side justified their decision to bat first.
Hashim Amla had earlier struck a boundary-filled 92 as South Africa - who need a victory to complete a 3-0 series sweep - recovered from 38-2.
Rahat Ali (3-95) and teenage debutant Ehsan Adil (2-54) each made a breakthrough with the new ball for Pakistan, Ali trapped Alviro Petersen lbw for 10 and Adil had Graeme Smith (5) held by a diving Younus Khan at second slip.
Amla counter-attacked with 13 fours in his 128-ball contribution, sharing stands worth 69 with Faf du Plessis (29) and 79 with De Villiers.
Pakistan hit back either side of tea; left-arm seamer Ali had Amla caught behind and trapped Dean Elgar lbw for seven before Robin Peterson (28) was run out to leave South Africa on 248-6.
But De Villiers, who has hit 13 fours in his 179-ball contribution so far, and Philander dominated the remainder of the evening session.