Nauman Ali claimed a maiden five-wicket haul to help Pakistan win the first Test against South Africa in Karachi, despite an early wobble in their run chase.
Having bowled out the Proteas for 245 in the first session on day four, the hosts lost openers Abid Ali and Imran Butt to slip to 23-2 when needing 88.
However, captain Babar Azam made 30 and despite his departure on the brink of victory, trapped lbw by Keshav Maharaj, first-innings centurion Fawad Alam hit the winning boundary to seal a seven-wicket triumph. Azhar Ali, meanwhile, finished up unbeaten on 31.
South Africa have now lost eight successive Tests overseas. They had resumed on 187-4 but managed to add just a further 58 runs for the loss of their final six wickets, debutant Nauman taking four of them as he finished with 5-35 from 25.3 overs.
Nightwatchman Maharaj was dismissed by the first ball of the day, bowled by one that kept a little low from paceman Hasan Ali.
Proteas captain Quinton de Kock then fell to Yasir Shah for two, giving the leg spinner a fourth wicket of the innings.
From then on, though, Nauman took charge. He worked his way through the tail and while Temba Bavuma battled hard, the batsman was last man out when trapped lbw by the left-arm spinner for 40.
Anrich Nortje gave the tourists a glimmer of hope when he dismissed both opening batsmen straight after the lunch break, but South Africa will rue a late clatter of wickets on day three having battled so hard with the bat to wipe out a first-innings deficit of 168.
Nauman makes an immediate impact
At 34 years and 111 days, Nauman was the fourth oldest debutant for Pakistan in the format. The wait proved worthwhile, though, as he finished with impressive match figures of 7-73.
While Yasir claimed the key scalp of De Kock, it was his fellow slow bowler who made sure the home team were left with a manageable target on a tired pitch showing obvious signs of variable bounce.
Babar celebrates home comforts
Despite his late dismissal - falling for a second time in the game to the left-arm spin of Maharaj - Babar can reflect on a satisfying first outing as Test skipper, having missed the 2-0 series defeat in New Zealand due to injury.
As was the case against the Black Caps, the top order struggled for runs. However, Fawad's superb first-innings century helped lead a recovery and the result means Pakistan cannot lose the series now. The second and final match takes place in Rawalpindi, starting on February 4.
For in-depth, objective and more importantly balanced journalism, Click here to subscribe to Outlook Magazine