Shaheen Afridi took four wickets in the final innings after going wicketless in the first session.
First Test, the Gaddafi Stadium (the fourth day)
The home side 378 (Imam 93, Agha 93; Muthusamy 6-117) & 167 (Babar Azam 42; Muthusamy 5-57)
The visitors 269 (Tony de Zorzi 104; Noman Ali 6-112) & 183 (Brevis 54; Shaheen 4-33, Noman Ali 4-79)
Pakistan won by 93 runs
The national team halted world champions the Proteas' unbeaten run by achieving a 93-run triumph in an exciting and closely contested first Test in Lahore.
The Proteas, who had a 10-Test winning streak in the longest format culminated in a win against Australia in the World Test Championship final in June, were dismissed for 183 in pursuit of 277.
Having resumed on 51-2, they lost first-innings centurion Tony de Zorzi lbw to left-arm quick Afridi to the third delivery of the day to shift the tightly balanced run chase in the home team's favor.
Left-arm spinner Noman, who secured 10 wickets for 191 runs in the game, removed Tristan Stubbs for two and clean bowled Dewald Brevis, who put up a fight with a rapid 54.
Right-arm spinner Sajid also took advantage of sharp turn to terminate opener Rickelton's innings - he faced 145 balls for 45 runs - and Shaheen returned in the post-lunch session to dismiss the tail with a fine display of reverse swing.
He trapped Kyle Verreynne lbw for 19 and dismissed Subrayen and Kagiso Rabada to seal the victory.
It was both sides' opening game of the 2025-27 Test championship cycle and moves Pakistan directly into the number two spot behind leaders Australia.
The win was founded on key performances of 93 by opener Imam and, crucially, all-rounder Agha which boosted them to 378.
From there slow bowlers Noman Ali and Sajid Khan utilized favourable home conditions, as they had in their Test series win over the English team the previous year, to sustain their lead.
The next and final Test begins on 20 October.