Duanne Olivier took his third five-wicket haul of the series as South Africa gained a 77-run first innings lead on the second day of the third and final Test against Pakistan at the Wanderers Stadium on Saturday.
The fast bowler took five for 51 as Pakistan were bowled out for 185. The tourists lost their last five wickets for 16 runs.
South Africa were 25 for one in their second innings at tea, losing stand-in captain Dean Elgar, who was caught behind off Mohammad Amir for five.
Olivier was twice involved in crucial breakthroughs in Pakistan's innings.
He ended an hour of frustration for South Africa when he took two wickets in four balls immediately after the morning drinks break, ending the stubborn resistance of nightwatchman Mohammad Abbas, who batted for 88 minutes and faced 51 balls in scoring 11. Three balls later Asad Shafiq ducked a bouncer but was caught behind off his glove.
Abbas and opening batsman Imam-ul-Haq, who went on to make 43, were both dropped twice during the first hour of play. South Africa also missed two run-out opportunities.
Pakistan were reduced to 91 for five when Imam was caught at second slip off Vernon Philander but Babar Azam (49) and captain Sarfraz Ahmed (50) put on 78 off only 61 balls for the sixth wicket.
Kagiso Rabada ended the stand when Sarfraz was caught at first slip and four balls later Olivier had Azam caught at long leg. Olivier made it a double strike when Faheem Ashraf was out first ball, splicing a mistimed pull to short leg.
Olivier started the series as South Africa's fifth-choice fast bowler but played in the first Test in Centurion because of injuries to Vernon Philander and Lungi Ngidi. He had match figures of 11 for 96, prompting South Africa to opt for a four-man pace attack when Philander returned for the second Test.