Hasan finished with 5-60 to record his best match figures of 11-114 and help dismiss South Africa — who were set a daunting 370 to chase — for 274 before the tea break.
SCORECARD: Pakistan vs South Africa, 2nd Test
Hasan’s new-ball partner Shaheen Shah Afridi finished with 4-51, while spinner Yasir Shah took the last wicket to spark jubilation among the Pakistan players.
Opener Aiden Markram scored a fighting 108 and Temba Bavuma 61.
They put on a 106-run stand for the fourth wicket to give Pakistan a scare.
Pakistan take the series 2-0! Hasan Ali took a match-haul of 10 wickets to lead the side to their first Test seri… https://t.co/n58o30Q1KJ
— ICC (@ICC) 1612775897000
Markram took a single off the last ball before lunch as South Africa reached the break on 219-3, needing 151 for a win.
But Hasan ripped through the tourists’ batting order, which lost seven wickets for just 33 runs with the second new ball.
Hasan struck with the second over of the new ball to end Markram’s resistance by getting the opener caught in the slip and end his 335-minute fight.
Markram’s fifth Test century — the first outside South Africa — included 13 boundaries and three sixes.
Next ball, Hasan had Quinton de Kock caught in the slip for nought, ending South African skipper’s miserable series with just 46 runs.
Hasan dismissed George Linde for four to record his third five-wicket haul as he improved upon his previous best match figures of 7-83 against New Zealand in Abu Dhabi in 2018.
In the morning, both teams were involved in a keen battle for victory as South Africa resumed on 127-1, knowing the best chase at Rawalpindi Cricket Stadium in ten previous Tests was the 200 scored by Sri Lanka in 2000.
South Africa saw Dussen bowled off a beautiful inswinger by Hasan — only the third ball of the day — while Du Plessis was leg-before to the same bowler in the fifth over of the morning.
It capped a sub-par series for the experienced Du Plessis who managed just 55 in four innings.
This is Pakistan’s only second Test series win over South Africa in 12 attempts, having lost eight and drawn three.
Pakistan last beat South Africa 1-0 in a two-match series at home in 2003.
Pakistan won the first Test by seven wickets in Karachi.
The series against South Africa — who were touring Pakistan for the first time in 14 years — is the biggest hosted by the home side since a deadly 2009 militant attack on Sri Lanka’s squad in Lahore halted international tours.
The series win also lifts Pakistan to fifth in international Test rankings — the first time they have placed in the top five since January 2017.
South Africa are pushed to sixth from fifth.
The two teams will now play three Twenty20 internationals on February 11, 13 and 14, all in Lahore.