Pakistan rode on skipper Sarfraz Ahmed's unconquered 61 off 79 balls to recover from a middle-order collapse and pull off a three-wicket victory over Sri Lanka in a virtual quarter-final Group B ICC Champions Trophy clash at Sophia Gardens here on Monday to qualify for the semifinals.
Pakistan will now take on England in the first semi on Wednesday. The other last-four tie is between India and Bangladesh on Thursday.
Chasing 237 for a triumph, fast bowler Mohammad Amir (28) showed great resolve to stitch together an unbeaten 75-run stand with Sarfraz for the eighth wicket to help his side win in a see-saw battle.
At one point, Sri Lanka had their rivals on the mat at 162/7 but had poor fielding and dropped chances to blame for their loss.
Pakistan, which chased the target in 44.5 overs, got off to a rollicking start riding young southpaw Fakhar Zaman's quickfire 36-ball 50 before Nuwam Pradeep (3/60) put a spanner on his works by getting him out just when he was looking very good.
The opening pair of Zaman and Azhar Ali stitched together a 74-run partnership.
Ali's dogged (34) came to a premature end also after Babar Azam (10) and Mohammad Hafeez (1) failed to contribute.Pakistan lost the middle order in a hurry with seasoned campaigner Shoaib Malik (11), Imad Wasim (4) and Fahim Ashraf (15) not lasting long.
It was down to Sarfraz to lead from the front and the 30-year old made the most of two reprieves to steer Pakistan over the line along with important contribution from Amir.
Sarfraz, whose innings was laced with five boundaries, was dropped twice by Thisara Perera and substitute Seekkuge Prasanna on 38 and 40 respectively, both times off Lasith Malinga's bowling.
Earlier, Pakistan pacers put up a stunning display to dismiss Sri Lanka for 236 runs in 49.2 overs.
Fast bowlers Junaid Khan (3/40), Hasan Ali (3/43), Amir (2/53) and debutant Ashraf (2/37) ran through the deep Sri Lankan batting line-up which stood firm against favourites India the other day, giving Pakistan's less equipped batting a 237-run target to chase down for victory.
For Sri Lanka, Niroshan Dickwella (73) was the top-scorer who along with skipper Angelo Mathews (39) stitched together the highest partnership of the innings - 78 runs for the fourth wicket.
Towards the end, Suranga Lakmal (26) and Asela Gunaratne (27) joined hands for a vital 46-run partnership for the eighth wicket which helped their side cross the 200-mark.At the start, Junaid sent back Danushka Gunathilaka (13) who gave Malik at mid-off an easy catch.
Kusal Mendis (27) and Dickwella had set up a 56-run second-wicket stand when a Hasan Ali ripper went through the former's defence as he was trying to whip the ball on the leg side.
Debutant Ashraf further shaved off the Sri Lankans' top order by bagging his first ODI scalp, sending Dinesh Chandimal back in the hut for a duck.
Amir got his first wicket in the tournament as he removed Mathews (39) with a angling delivery that got a thin inside edge off the bat and onto the stumps.
Dhananjaya De Silva (1) did not last long handing Junaid Khan his second wicket off a brilliant delivery as Sri Lanka had half their side down for just 162 in 33 overs.
In the next over, Sarfraz took a brilliant catch diving to his right to dismiss the dangerous Dickwella off Amir's bowling.
Perera could manage just 1 as Junaid picked up his third wicket and Pakistan bowlers made the most of swing on offer to outfox the Sri Lankan batsmen.
Lakmal and Gunaratne batted well towards the end to propel Sri Lanka to a decent total before removed the pair. Malinga remained not out on 9 as Ashraf got the better of Nuwan Pradeep (1).
Brief scores: Sri Lanka -- 236 all out in 49.2 overs (Niroshan Dickwella 73, Angelo Mathews 39; Junaid Khan 3/40, Hasan Ali 3/43, Fahim Ashraf 2/37, Mohammad Amir 2/53); Pakistan 237/7 in 44.5 overs (Sarfraz Ahmed 61 not out, Fakhar Zaman 50; Nuwam Pradeep 3/60)