Pakistan beat South Africa by three wickets in the fourth T20I to win series 3-1.
Babar Azam scores sensational 122 while Mohammad Rizwan unbeaten 73 give Pakistan 2-1 lead.
Markram continues to impress at the top for the hosts, hitting his second fifty on the trot
Blazing half-centuries from Markram and Klaasen, and a fine spell from Shamsi, went in vain.
Mohammad Nawaz and debutant Usman Qadir shared four wickets after the batsmen took them to 320.
Rassie van der Dussen and Quinton de Kock also chip in with vital half-centuries in big batting effort.
Between a flinty century and a brilliant hundred, South Africa and Pakistan battled out in a last-ball thriller.
CSA announce ODI And T20I squads; No IPL-Bound players to feature in the T20I series against Pakistan.
Pakistan named disgraced opener Sharjeel Khan, who served a ban for spot-fixing, in the national T20 squad.
The ODI series will be part of the ICC Super League, which is a pathway for direct qualification for the 2023 World Cup.