Imad Wasim's unbeaten 49 made sure Pakistan moved into the top four of the table after falling to 156-6 when chasing a modest total of 228.
Fans then spilled onto the pitch in chaotic scenes after the winning runs were struck.
There were also ugly scenes before the match on Saturday when police had to intervene after violent clashes between rival supporters outside the ground.
"It is a great win for us on not an easy pitch," said Sarfaraz. "We know it was not an easy target. Their bowlers used the conditions very well. Everyone chipped in, it was good team work."
After a terrible start with just one win from their opening five matches, Pakistan have now won three in matches in succession to leapfrog hosts England into fourth place.
A semi-final place is still in England's hands, but they face the daunting task of having to beat at least one and most likely both of India and New Zealand in their final two fixtures.
"We all know that it is not easy to win our last four games, we go match by match," added Sarfaraz, whose side face Bangladesh in their final group game. We will all be watching India v England tomorrow."
Afghanistan captain Gulbadin Naib was left to regret bringing himself on to bowl at the death.
With the run rate spiralling, his penultimate over went for 18 runs.
"It was bad luck," said Gulbadin. "It was very difficult for Pakistan to chase that total on a turning wicket. It was the turning point."
Man-of-the-match Imad admitted he had targeted Gulbadin after struggling to score quickly off the Afghan spinners
"Gulbadin was the only one who could be targeted," he said. "They have world-class spinners so we attacked him."