An inexperienced Pakistan pace bowling line-up had South Africa in trouble before AB de Villiers steered the hosts to a respectable total on the first day of the third and final cricket Test in Centurion.
De Villiers made an unbeaten 98 as South Africa reached 334 for 6.
De Villiers and Hashim Amla, who made a sparkling 92, were the only top-order batsmen to play significant innings against a three-man Pakistan bowling attack with only two Test caps between them.
Rahat Ali and Ehsan Adil, neither of whom had taken a wicket in Test cricket before, were responsible for the first five dismissals as South Africa stumbled to 196 for 5.