The Pakistani team Halts South Africa's 10-match Unbeaten Run.
The left-arm pacer secured four wickets in the final innings after failing to take a wicket in the first session.
Opening Test, Lahore (day four)
Pakistan 378 (Imam 93, Salman Agha 93; Senuran 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 Afridi 4-33, Noman Ali 4-79)
The hosts secured a 93-run victory
The national team terminated the reigning champions South Africa's winning streak by sealing a 93-run margin win in an thrilling and competitive first Test in the city of Lahore.
The Proteas, who had a 10-Test unbeaten run in Test cricket ended with victory over Australia in the World Test Championship final in the month of June, were bowled out for 183 in pursuit of 277.
Having resumed on 51-2, they lost century-maker De Zorzi lbw to pace bowler Afridi to the third ball of the day to push the tightly balanced chase in Pakistan's favour.
Left-arm spinner Noman Ali, who claimed 10-191 in the match, dismissed Tristan Stubbs for two and bowled Dewald Brevis, who offered some resistance with a run-a-ball 54.
Off-spinner Sajid Khan also took advantage of significant spin to terminate opening batsman Ryan Rickelton's stay - he lasted 145 deliveries for 45 - and Afridi returned in the post-lunch session to dismiss the lower order with a impressive exhibition of reverse swing.
He had Kyle Verreynne lbw for nineteen and bowled Prenelan Subrayen and Rabada to secure the victory.
It was each team's opening game of the 2025-2027 World Test Championship cycle and moves Pakistan straight into second place behind table-toppers the Australian team.
The win was built around key performances of 93 by opener Imam-ul-Haq and, crucially, number seven Agha which boosted them to three hundred and seventy-eight.
After that spinners Noman and Sajid Khan took advantage of helpful home pitches, as they had in their series victory over England the previous year, to maintain their lead.
The next and last match starts on 20 October.