The Pakistani team Ends the Proteas' 10-match Victory Run.
Shaheen Afridi secured a quartet of wickets in the final innings after going wicketless in the first session.
Opening Test, the Gaddafi Stadium (the fourth day)
The home side 378 (Imam 93, Agha 93; Senuran Muthusamy 6-117) & 167 (Babar Azam 42; Muthusamy 5-57)
The visitors 269 (Tony de Zorzi 104; Noman 6-112) & 183 (Brevis 54; Shaheen 4-33, Noman Ali 4-79)
Pakistan won by 93 runs
Pakistan terminated world champions South Africa's winning streak by completing a 93-run margin triumph in an thrilling and closely contested opening Test in Lahore.
South Africa, who had a 10-match winning streak in the longest format ended with a win against Australia in the WTC final in June, were dismissed for 183 in pursuit of 277.
Starting the day on 51 for two, they saw the dismissal of first-innings centurion De Zorzi lbw to left-arm quick Afridi to the third ball of the day to push the tightly balanced run chase in Pakistan's favor.
Left-arm spinner Noman, who secured 10 wickets for 191 runs in the match, dismissed Tristan Stubbs for 2 and bowled Brevis, who offered some resistance with a run-a-ball 54.
Off-spinner Sajid also capitalized on sharp turn to terminate opening batsman Rickelton's stay - he lasted 145 balls for 45 runs - and Shaheen returned in the post-lunch session to knock over the lower order with a fine display of reverse-swing bowling.
He had Kyle Verreynne lbw for 19 and bowled Subrayen and Kagiso Rabada to seal the win.
It was both sides' opening game of the 2025-27 World Test Championship cycle and propels Pakistan straight into second place after table-toppers Australia.
Their victory was built around contributions of 93 by opener Imam and, importantly, number seven Agha which lifted them to 378.
From there spinners Noman Ali and Sajid took advantage of helpful home pitches, as they had in their Test series win over the English team the previous year, to maintain their lead.
The next and final Test begins on 20 October.