Afghanistan yet again came close to creating a big upset but were denied by Wasim, who emerged an unlikely batting hero along with Wahab Riaz
Shaheen Afridi's four-wicket haul helped them limit the gritty rivals to 227 for nine in their must-win game
Contributions from Asghar Afghan (42 off 35) and Najibullah Zadran (42 off 54) gave the bowlers something to bowl at.
Until the time Babar Azam was at the crease, Pakistan looked increasingly likely to win. However, he was dismissed for 45 by Mohammad Nabi.
It was Mujeeb ur Rahman (2/34) and Mohammed Nabi (2/23) who saw off the Pakistan top-order to set it up nicely for Afghanistan.
Imad Wasim (49 not out), along with Wahab Riaz (15 off 9), showed nerves of steel to guide them to a tense three-wicket win.