Pakistan survived a scare to beat Afghanistan by three wickets with two balls remaining in a thriller at Headingley that moves Sarfaraz Ahmed's side above England in the race for a World Cup semi-final spot.
Chasing 228 for victory, Pakistan fell to 81-3 and 156-6 as Afghanistan turned the screw and, with 48 needed from 36 balls, it looked out of Pakistan's hands.
However, a disastrous 46th over by Afghanistan captain Gulbadin Naib went for 18 runs to put Pakistan back in control.
Despite Shadab Khan being run out with 22 runs needed for victory, Imad and Wahab Riaz held their nerve, with Wahab striking the first six of the innings to take the rate down to a run a ball.
In an astonishing finish, Imad drove Gulbadin to the boundary to reach an unbeaten 49, tie up victory and move his side ahead of England in the table.
It makes it more likely that England will need to beat both India on Sunday and New Zealand on Wednesday to reach the last four.
Afghanistan, meanwhile, are still winless - and just as they did against India, they have come tantalisingly close to a stunning victory.
With Pakistan needing 46 runs from 30 balls, Gulbadin brought himself back on to bowl to Imad Wasim - a decision which swung the momentum back to Pakistan.
Before the over, Pakistan had been struggling; they were limited to singles, had hit just two fours in the previous 18 overs and the vociferous crowd had been silenced.
However, such a costly over put things firmly back in Pakistan's favour.
Wahab, batting with a broken finger, hit 15 from nine balls, with one four and one six, to settle any nerves after Shadab was needlessly run out going for a second.
This had been, up until the final hour or two, a meandering game before it was sparked into life by the introduction of Mohammad Nabi.
Pakistan lost Fakhar Zaman lbw to the second ball of their reply but Nabi claimed two wickets in two overs, having Imam-ul-Haq stumped as he charged him, before the in-form Babar Azam was bowled around his legs.
Once Haris Sohail fell, caught going back into his crease against Rashid Khan, Pakistan's middle order was exposed.
Captain Sarfaraz Ahmed was run out while trying to make a second run that was never on offer, leaving Wasim, Shadab and Wahab to display the necessary calm heads.
Wasim, though, was fortunate - he should have been out lbw early in his innings but the appeal off Rashid Khan was turned down and Afghanistan had used up their review.
At 145-5, it might have proved terminal for Pakistan. As it was, they will take heart from the way they came through a tight situation - something their biggest semi-final rivals England have yet to do.
Afghanistan were competitive against Pakistan, which has not always been the case during this World Cup.
They have not had a settled side, have rarely performed with the bat, and their fielding has been poor.
At Headingley, they tantalised, putting in their best batting performance and following it up with a good bowling performance that imploded in the 46th over.
None of their batsmen were able to pass 42, however, as Pakistan's young left-arm quick Shaheen Afridi (4-47) once again impressed.
'We will be watching England tomorrow' - what they said
Pakistan captain Sarfaraz Ahmed: "Thank you all the fans, they cheered every ball. It is a great win for us on not an easy pitch."We know it was not an easy target. Their bowlers used the conditions very well. Everyone chipped in, it was good team work.
"We all know that it is not easy to win our last four games, we go match by match. We will all be watching India v England tomorrow."
Afghanistan captain Gulbadin Naib: "We fought really well, the boys gave 100% but in the end we missed an opportunity to win the match. Credit to Pakistan, they controlled their nerves.
"It was bad luck [when I went for 18 in an over]. Hamid Hassan was injured, it was very difficult for Pakistan to chase that total on a turning wicket. It was the turning point."
Source: BBC Sports