Sri Lanka escaped with a two-run victory and qualified for the Super 4 in the Asia Cup after Afghanistan somewhat miscalculated its chase of a tough target in the last group game on Tuesday.
Afghanistan was poised to knock Sri Lanka out of the tournament on net run-rate as it needed to achieve a 292-run target in 37.1 to advance from Group B with Bangladesh.
Mohammad Nabi increased Afghan hopes with a blistering 65 off 32 balls as he raised his country's fastest half-century off 24 balls before he fell in the 27th over when Dhananjaya de Silva made a brilliant running catch in the outfield.
Karim Jannat (22), Najibullah Zadran (23) and Rashid Khan (27 not out) kept pushing on Sri Lanka pace and spin with little cameos before Mujeeb Ur Rahman holed out at long on as Afghanistan slumped to 289-9 in 37.1 overs.
Afghanistan apparently was unaware of the calculation that it could still make it to the Super 4 had they reached 295 over the next three balls.
No. 11 batter Fazalhaq Farooqi defended the next two balls of part-time spinner de Silva before getting trapped lbw off the next ball that left Rashid stranded at the non-striker's end and Afghanistan was bowled out for 289 in 37.4 overs.
Nabi showed plenty of aggression against the pace of Matheesha Pathirana and Maheesh Theekshana by hitting five sixes and six boundaries in his knock before he finally holed out with Afghanistan still needing 91 runs for victory.
Fast bowler Kasun Rajitha picked up 4-79, that included two early wickets, but the fast bowler went for plenty against Afghan batters, who kept Sri Lanka bowlers under pressure with aggressive shots.
"Very disappointed about it," said Hashmatullah Shahidi, who also scored 59 off 66 balls. "We fought well (and) we gave our 100 percent. I am proud of the team, the way they played and fought till the last ball."
Earlier, Kusal Mendis missed out on a century but his 92 off 84 balls and a half-century stand between Dunith Wellalage (33 not out) and Maheesh Theekshana (28) farmed Sri Lanka's total of 291-8 after captain Dasun Shanaka won the toss and elected to bat.
Pathum Nissanka (41) and Dimuth Karunaratne (32) provided a solid start of 63 before Gulbadin Naib's (4-60) triple strike during his seven-over spell in hot and humid weather of Lahore reduced Sri Lanka to 86-3.
But Mendis rebuild the innings in a 102-run stand with Charith Asalanka (36) before Rashid had the latter caught off his own bowling and de Silva was clean bowled by Mujeeb. Mendis was unfortunate to miss out on the century when he was run out after Rashid dropped Shanaka off his own bowling but the ball rolled back onto the stumps at the non striker's end with Mendis well short of his crease.
Wellalage and Theekshana then combined in a 54-run eighth wicket stand and edged closer to the 300-run mark.
"A couple of wickets opened the door for us," Shanaka said. "Nabi took the game away from us. However, we ended up winning, that's what is important."
Pakistan will take on Bangladesh in the first Super 4 game at Lahore on Wednesday before the tournament moves to Sri Lanka for the remaining five Super 4 games and the final scheduled for September 17.