Pakistan cricket team
Pakistan end South Africa's unbeaten Asia record with T20 series win
The victory is Pakistan's 100th in 163 matches, the first team to complete a century of wins in T20 internationals.
The touring team will stay in a bio-secure environment and matches will be confined to two venues – SuperSport Park in Centurion and the Wanderers Stadium in Johannesburg.
Needing 19 to win off the last over, Bjorn Fortuin (17 not out) and Dwaine Pretorius (15 not out) managed 15 as pacer Faheem Ashraf held his nerve to keep South Africa down to 166-6 in 20 overs.
The hosts have won just one of their last eight Twenty20 series, with victory coming against lowly Zimbabwe.
Misbah - whose position as head coach was in danger after a 2-0 defeat in the preceding series in New Zealand - said his team were now heading in the right direction.
Set 370-run to win, the Proteas were bowled out for 274 with Pakistan medium pacer Hasan Ali taking 5-60 - his best match figures of 10-114.
Temba Bavuma hit 44 not out as the pair guided South Africa to 219-3, needing another 151 runs in pursuit of a daunting 370-run target in a possible 65 overs.
South Africa were in trouble at 106-4 after the second day's play on a tricky Rawalpindi stadium pitch, trailing Pakistan's first innings total of 272 by 166 runs.
At lunch, Faheem Ashraf was on a gritty 54 and Yasir Shah yet to score with Pakistan adding 84 in an extended session due to Friday prayers.
Pakistan, who won the toss and batted, reached 21 without loss before throwing away three wickets for one run in the space of 23 balls.
Pakistan, who lead the two-match series 1-0 after winning the first Test by seven wickets in Karachi, kept the same eleven, going with two spinners and three pace bowlers.
Cricket Australia announced on Tuesday that they would not be touring South Africa because of the COVID-19 situation in SA.
Pakistan, whose lone series win over South Africa was at home in 2003, start as favourites in Rawalpindi after last week's thumping seven-wicket win in Karachi.
The 40-year-old Hafeez is in the form of his life, scoring 502 runs in his last 12 Twenty20 internationals at an average of 100.40 with a strike rate of 153.
Spinner Nauman Ali took 5-35 in his debut match while Yasir Shah grabbed 4-79 as South Africa collapsed for 245 in their second innings.
Left-arm spinner Nauman Ali took 5-35 while Yasir Shah finished with 4-79 after South Africa resumed at 187-4. Temba Bavuma was the last man out for 40.
Earlier, Pakistan scored 378 to take a 158-run lead over South Africa's first innings total of 220.
Alam, playing his first Test at home, was unbeaten on 39 and Azhar was on 38 as Pakistan added 71 runs without losing any wickets in the morning session.
The visitors looked set earlier before Pakistan spinners Yasir Shah (3-54) and Nauman Ali (2-38) weaved their magic.