In heart-stopping action, gritty 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 (15 off 9), who hit a timely six off Rashid Khan to release the pressure.
Wasim had five half-centuries before this match but perhaps played the biggest knock of his life, soaking in tremendous pressure as Pakistan huffed and puffed to win with two balls to spare.
The Afghans after dominating the large part of the Pakistan innings, wilted under pressure, missing run outs and catches towards the dramatic end. They had come close to winning against India too but fell short.
The Afghanistan spinners turned the match on its head by reducing Pakistan to 156 for six and the modest 228-run target was now looking like a mountain to scale for the 1992 champions.
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.
When seasoned Rashid Khan got rid of Haris Sohail (27), Afghanistan sensed an upset and Pakistan skipper Sarfaraz Ahmed (18) helped the Afghan cause by running himself out at crucial juncture.
There was no Babar Azam (45) or Sohail at the crease to rescue Pakistan, who required 46 from the last five overs.
Afghan skipper Gulbadin came to bowl the 46th over and ended up leaking 18 runs with Wasim finding three boundaries in that over. It titled the match heavily in the favour of Pakistan.
With 16 needed off 12 balls, Riaz launched Rashid for a massive six in the second ball and eventually Pakistan needed six from last over.
Gulabdin brought himself again into the attack but Wasim steered him for a four in the fourth ball to finish it off for his side.
With this win, Pakistan have now jumped to the fourth spot with nine points, pushing hosts England to five. They would pray that India beat England tomorrow to enhance Pakistan's semifinal chances.
Earlier, Pakistan bowlers did not exactly dominate the Afghanistan batsmen but pacer Shaheen Afridi's four-wicket haul helped them limit the gritty rivals to 227 for nine in their must-win game.