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 Test at SuperSport Park in Centurion on Friday.
De Villiers made an unbeaten 98 as South Africa reached 334 for six.
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 five.
Left-arm Rahat, playing in his second Test, took three for 95, while new cap Adil, 19, took two for 54.
South Africa first innings
G Smith c Younis Khan b Ehsan Adil 5
A Petersen lbw b Rahat Ali 10
H Amla c Sarfraz Ahmed b Rahat Ali 92
F du Plessis c Sarfraz Ahmed b Ehsan Adil 29
A de Villiers not out 98
D Elgar lbw b Rahat Ali 7
R Peterson run out (M Irfan) 28
V Philander not out 45
Total (6 wkts, 85 overs) 334
Fall of wickets: 1-13 (Petersen), 2-38 (Smith), 3-107 (Du Plessis), 4-186
(Amla), 5-196 (Elgar), 6-248 (Peterson)
Bowling: Mohammad Irfan 16.5-3-59-0 (2nb), Rahat Ali 20-1-95-3 (6nb, 4w),
Ehsan Adil 12.1-2-54-2 (3nb), Saeed Ajmal 26-5-70-0, Younis Khan 3-0-14-0,
Mohammad Hafeez 5-0-24-0, Azhar Ali 2-0-13-0
Amla looked set for his 20th Test century before edging a drive against a wide delivery from Rahat to be caught behind by wicketkeeper Sarfraz Ahmed.
He struck 13 fours in a 128-ball innings and shared partnerships of 69 for the third wicket with Faf du Plessis (29) and 79 for the fourth wicket with De Villiers.
With the South Africans missing star all-rounder Jacques Kallis because of a calf injury, De Villiers took over responsibility for batting out the day.
He shared a sixth wicket stand of 52 with Robin Peterson, who made 28 before being run out, and an unbeaten seventh-wicket partnership of 86 with Vernon Philander (45 not out).
De Villiers faced 179 balls and hit 13 fours.
Although they produced wicket-taking deliveries, both Rahat and Adil were inconsistent and sent down enough loose deliveries for South Africa to maintain a scoring rate of close to four runs an over for much of the day.
Off-spinner Saeed Ajmal, the only experienced bowler in the side, was easily the most economical, conceding 70 runs in 26 overs.
Pakistan finished the day a bowler short after Adil limped off with what appeared to be a hamstring strain after sending down just one delivery with the second new ball.
The injury to Kallis meant a reshuffle to the South African team. He was replaced by fast-medium bowler Kyle Abbott, 25, who earned his first cap after being called into the squad as cover earlier in the week.
Abbott topped the wicket-takers in the domestic first-class competition, taking 49 wickets for the Dolphins at an average of 15.36.
It was the first time this season that South Africa had gone into a Test match without seven specialist batsmen.
South Africa, who had already clinched the series by winning the first two Tests, had one other injury-enforced change, with Rory Kleinveldt replacing fellow fast bowler Morne Morkel.
Pakistan made three changes, with Imran Farhat replacing opening batsman Nasir Jamshed, while Rahat and Adil came in for Umar Gul and Tanvir Ahmed.