Pakistan 378 and 90 for 3 (Azhar 31*, Azam 30, Nortje 2-24) beat South Africa 220 and 245 (Markram 74, van der Dussen 64, Nauman 5-35, Yasir 4-79) by seven wickets
It took about three hours of near-perfect cricket, but Pakistan eased the pressure on themselves and head coach Misbah-ul-Haq, cruising to a seven-wicket win to take a 1-0 lead in the two-match series. The win, Pakistan's only fifth in Test cricket over South Africa, looked a very distant prospect when the visitors sat pretty at 175 for 1 on Thursday evening, but a spectacular collapse supercharged by a five-wicket haul for debutant Nauman Ali saw the game ripped from their grasp.
After a flurry of wickets last evening, South Africa failed to arrest the slide as Yasir Shah and Nauman made hay. The visitors managed just 58 on top of overnight's score, and aside from a brief wobble after lunch that saw Anrich Nortje remove both openers in an over, the 88 Pakistan were set was achieved at a canter.
Hasan Ali began proceedings by getting rid of nightwatchman Keshav Maharaj off the day's first ball, one that kept slightly low to breach Maharaj's defence. Captain Quinton de Kock, who looked unlike himself during his scratchy little stay at the crease, became yet another victim to Abid Ali at short leg off Shah.
South Africa will likely be left to rue two batting collapses this Test, but the manner in which Temba Bavuma, who has had his struggles of late, dug in, there is encouragement to be found. On a raging turner, he found a balance that allowed him to score while neutralising the threat. Alongside George Linde, he struck up another handy little partnership to go with their 42-run stand in the first innings. The sweep shot was used cleverly, pushing back the close-in fielders, and it was to Bavuma's credit that Shaheen Shah Afridi looked somewhat flat with the new ball for a change. Slowly the lead pushed past 75, and South Africa sniffed hope once more.
It was, though, extinguished by another rush of breakthroughs as the second collapse of the innings was initiated when Linde's inside edge was plucked superbly by Imran Butt at leg slip. The batsmen that followed put up little resistance. Nauman spun one through the gate when Kagiso Rabada tried an extravagant cover drive, and completed his five-for - the seventh-oldest debutant to do so - when he trapped Bavuma in front, the sweep for once failing him.
It was never going to be enough, even if Pakistan have produced some legendary fourth-innings collapses in the recent past. For that reason, when Nortje knocked back Abid's stumps first ball after lunch, and had Butt nick off in the same over, a ripple of anxiety must have trickled through the Pakistan dressing room. It didn't help that variable bounce had come into the game again, and Babar Azam had his defence seriously tested by Nortje.
Once a couple of boundaries had been struck and the runs required came swiftly down, the fight began to sap out of South Africa. Azam shook off a failure in the first innings, demonstrating his touch with some luscious drives through the offside, while a handy cameo from Azhar Ali sat nicely alongside his half-century in the first innings. The last 46 runs came in 47 balls as Pakistan ended proceedings in a hurry, even if Maharaj claimed a moral victory when he snared Azam lbw for the second time in the game with two runs required. In the wider picture, though, South Africa were decisively condemned to their eighth successive defeat in the subcontinent.
Danyal Rasool is a sub-editor at ESPNcricinfo. @Danny61000