Vernon Philander took two Pakistan wickets in a dramatic final session after South Africa capitulated to 262 all out on day one of the final Test of the series at the Wanderers.
The Proteas, eyeing a 3-0 whitewash, were 226-3 at tea but folded in spectacular fashion, losing seven wickets for just 33 runs in Johannesburg on Friday,
Aiden Markram, passed fit after recovering from a thigh injury, top scored with 90 and Theunis de Bruyn fell one short of a half-century before the tourists tore through the South Africa order.
The recalled Faheem Ashraf took 3-57, while Mohammad Amir, Mohammad Abbas and Hasan Ali claimed two wickets apiece as seven fell in just under 17.2 overs - the quicker bowlers thriving in the absence of Yasir Shah (knee).
Philander then shifted the momentum firmly in South Africa's favour by snaring Shan Masood caught behind and removing Azhar Ali in the same fashion from the next delivery, with Pakistan closing on 17-2.
Dean Elgar, captain with Faf du Plessis suspended due to a slow over-rate in the second Test, fell for only five after winning the toss when he was caught behind off Abbas but Markram and Hashim Amla prevented Pakistan from making further early inroads.
Markram played fluently, finding the gaps on both sides of the wicket and he was unbeaten on 78 at lunch after a glorious straight drive off Abbas (2-44) gave him a 14th boundary.
The opener missed out on a fifth Test century when he was strangled down the leg side off Ashraf to end a stand of 126 and Amla (41) followed after edging the recalled Shadab Khan to Asad Shafiq in the slips.
De Bruyn (49) and debutant Zubayr Hamza (41) put on 75 for the fourth wicket, but South Africa fell to pieces after the former was trapped leg before by Abbas.
Amir - who was this week recalled to the ODI squad - had Temba Bavuma and Hamza caught behind and Ashraf took two wickets in as many overs to wrap up the innings in a flash.
The procession of wickets continued when Pakistan started their reply, Masood given out caught behind following a review and Philander drawing an edge from Azhar to leave Pakistan in the mire on 6-2.
Imam-ul-Haq and nightwatchman Abbas were still there at stumps, but Pakistan will need to apply themselves on Saturday as they attempt to secure a consolation victory.
|Kohli makes history with ICC awards sweep|
|Thompson sets NBA record with 10 straight made three-pointers to open game|
|76ers hand Rockets largest loss of season, Harden scores 37 points|
|Tsitsipas overcomes Bautista Agut to continue Aus Open run|
|Barcelona move a ´dream come true´ for Boateng|
|Rams coach McVay on Gurley: I´ve got to get him more opportunities|
|Butler´s sprained wrist not expected to keep him out ´long term´|
|Saints owner Benson will ´aggressively pursue changes in NFL policies´|
|Levante to take Copa case to CAS|
|It can happen – Allegri plays down Ronaldo penalty miss|
|Mavericks´ Doncic becomes second-youngest player to record triple-double|
|Yankees send Sonny Gray to Reds|
|Ashley Cole reunited with Frank Lampard at Derby County|
|Arnold ready to mix things up in 2019 Asian Cup quarter-finals|
|Arum: Joshua desperately needs to fight in the United States|
|South Korea v Bahrain: Bento optimistic of continuing unblemished campaign|
|Bolton Wanderers 0 West Brom 2: Baggies bounce up to third after tennis ball protest|
|Confident Moeen ready to shine for England in the Caribbean|
|Juventus 3 Chievo 0: Allegri´s men cruise despite Ronaldo penalty save|
|Boateng completes shock Barcelona switch|
|United Arab Emirates 3 Kyrgyzstan 2 (after extra time): Khalil penalty sets up Socceroos showdown|
|West Indies add Drakes to new-look coaching team|
|Barcelona is a huge opportunity – Boateng confirms shock move is close|
|Donnarumma wishes Higuain luck ahead of expected Chelsea switch|
|Qatar v Iraq: Katanec anticipating ´huge challenge´ in last 16|
|Nuno hit with FA misconduct charge for pitch celebration|
|Furious Carreno Busta and Zverev bow out, Djokovic marches on|
|#NotMartinFromWakefield – Siewert shows viral sensation the door|
|Djokovic feeling the strain after late-night Medvedev battle|
|Henderson sidelined again ahead of Six Nations|
|Australia 0 Uzbekistan 0 (aet, 4-2 on penalties): Ryan heroics see holders hobble onwards|
|Halep exit leaves four-way fight to be crowned number one at Australian Open|
|Super Bowl-bound Rams set for London return, Chiefs to face Chargers in Mexico|
|Huddersfield appoint Siewert as Wagner´s replacement|
|Genoa 0 AC Milan 2: Borini and Suso step up with Higuain left out|
|McTominay signs new Manchester United contract|
|Pizzi to stand down after Saudi Arabia elimination|
|Boateng closing in on shock Barcelona switch - reports|
|Catalans to defend Challenge Cup after resolving RFL dispute|
|Djokovic wears down Medvedev to reach last eight|
|Mouratoglou: I knew ´loyal´ Serena would not fire me after US Open turmoil|
|Barcelona B defender Wague accuses Ejea fans of racist abuse|
|I felt like I had been hit by a train - Halep upbeat despite losing Serena battle|
|Arsenal confirm Mislintat departure|
|Icardi will renew, 100 per cent - Wanda Nara offers latest Inter assurance|
|Japan 1 Saudi Arabia 0: Four-time winners send Pizzi´s men out|
|A souvlaki maybe named after him, a growing fan base – Tsitsipas creating Melbourne buzz|
|Barca winger Dembele out for 15 days|
|Strikers blown away by Hurricanes in Adelaide|
|Ireland lose Beirne for England and Scotland clashes|
|´Innate fighter´ Serena says character key to beating Halep|
|Hudson-Odoi ´an outstanding talent´ - Bayern great Ballack hails Chelsea youngster|
|Scotland call up four as hand injury forces Watson out|
|Serena comes through major Halep battle to reach last eight|
|Better than Rafa? Camacho cameo leaves Klopp unconvinced by transfer options|
|England job ´a privileged position´, says Southgate|
|Emery has confidence in Arsenal outcast Ozil|
|Zverev destroys racquet in Aus Open meltdown|
|From Villarreal to Aus Open quarters – Bautista Agut breaks major duck|
|Brees: I plan on being here next year and making another run at it|
|´Unf******-believable bro!´ - Brady stunned after reaching third straight Super Bowl|
|New England find answers, penalty costs Kansas City – three takeaways from Patriots´ win over Chiefs|
|Donald Trump congratulates Brady and Super Bowl-bound Patriots|
|Rose helps Timberwolves down Suns|
|Brady leads Patriots into third straight Super Bowl|
|Osaka overcomes Sevastova to reach quarters|
|Chelsea remain behind Sarri – David Luiz|
|McVay explains Gurley´s limited role in Rams´ win over Saints|
|Southgate hails ´tremendous talent´ Rashford|
|Long earns maiden PGA Tour win at Desert Classic|