On day four of the Rawalpindi Test, South Africa chased the small target of 68 runs for the loss of two wickets, winning the match by eight wickets and also squaring the two-match series 1-1.
South Africa Captain Aiden Markram scored 45 runs, while Pakistan spinner Noman Ali grabbed two wickets.
In their second innings, the Pakistan team collapsed to just 138 runs, with Babar Azam scoring a fifty.
South African spinner Simon Harmer did not allow any Pakistan batter to stay long at the crease, clinching six wickets.
Pakistan had won the first test match by 93 runs against the visitors in Lahore.