Qualification to the semis was the prize riding on this game that was a quarter-final in all but name, and it was clear both sides wanted it desperately. Sri Lanka started impressively but a brilliant spell midway from Mohammad Amir and Junaid Khan restricted them to 236. Pakistan made the chase look harder than it was but captain Sarfraz Ahmed and Amir were there at the end to see their side home. Though the prospect of facing England in three days time will be daunting, it will be the last thing on their minds right now.
From the moment Pakistan's seventh wicket fell - with 75 still to win - two antsy sides were hoping they could do just about enough to pip the other. Sri Lanka were the favourites at that point, but their fielding let them down badly. Thisara Perera dropped a sitter at mid-on in the 39th over. Substitute fielder Seekkuge Prasanna shelled another chance - albeit a more difficult one - in the 41st. And Sarfraz, the reprieved batsman, the last of the specialists, took the game away.
Lasith Malinga, Sri Lanka's great talisman, had created both chances and if this is to be his final ICC tournament, it was a cruel way to go. He watched, helplessly, as his team began to gift overthrows, and little by little, the belief as well to the Pakistan batsmen. By the time a dispirited Malinga was brought back for his final over, the fielding had disintegrated to amateurish level. Eventually, Sarfraz dabbed him over third man for the winning runs, and a shocking last half hour for the Sri Lankans met the end it deserved.
Before the nerves got hold of them, Pakistan were cruising. A dropped catch and a run-out opportunity in the first two overs aside, Fakhar Zaman and Azhar Ali set about their task masterfully.
Fakhar, comfortable in his role as the designated aggressor up front, hit three boundaries in the third over against Malinga. He didn't mind riding his luck at times, an outside edge burst through slips for four while a top edge flew for six, and when he was dismissed - caught at long leg - he had scored 50 off 36 and Pakistan were sitting pretty at 74 for 1 in 11.2 overs.
But with this being Pakistan, there was the inevitable feeling they would take the Rolling English Road to victory. Two wickets fell quickly as Babar Azam clipped Nuwan Pradeep straight to short midwicket and Hafeez chipped one to mid-on next over. Opener Azhar Ali was done in by the extra bounce of Suranga Lakmal soon after, edging a sharp catch to first slip. Pakistan were at 110 for 4, and the game was anything but a foregone conclusion.
Sri Lanka were quietly climbing into a position of ascendancy, but Pakistan almost appeared not to notice the early signs of danger. It certainly couldn't be ignored when Shoaib Malik gloved a short ball from Malinga to the keeper. When Imad Wasim fell five balls later, Pakistan were 6 down with 100 runs still to win.
Debutant Faheem Ashraf's short-lived stay at the crease was fraught with danger as the bowlers peppered him with short deliveries, several of which caught his top edge but managed to evade the boundary riders. For all the risks he was taking on strike, he was run-out at the other end, a ricochet off the bowler's hand finding the stumps before his bat hit the ground.
There were no such errors from Pakistan with the ball though. In fact they were so good that Sri Lanka, despite dominating large parts of their innings, were bowled out well below the par score.
A sensational four-over burst from Amir and Junaid ripped the heart out of the Sri Lankan middle order as they went from 161 for 3 to 167 for 7. It was superb fast bowling, evoking comparisons with some of the greats of Pakistan cricket and that it came soon after the innings' second drinks break spoke either to some kind of strategy, or an especially rousing team talk from the captain Sarfraz. Either way, it was match-turning.
Sri Lanka were setting up effectively for the final flourish, with Niroshan Dickwella and Angelo Mathews locked in a settled partnership, before Amir dismissed Mathews off the second ball of the 32nd over, the batsman dragging onto his stumps. Junaid followed up next over with a length delivery that seamed teasingly away from newcomer Dhananjaya de Silva and took his outside edge. Sarfraz then pulled off a superb reflex catch to get rid of Dickwella for 73 and Thisara was caught at slip next over. Sri Lanka's position of strength was decimated in mere minutes.
If it appeared that passage of play would be the solitary turning point of the match, Pakistan and Sri Lanka showed that when they take on each other, it is never quite that simple.