HAMBANTOTA, Sri Lanka (AP) — Pakistan’s tailenders kept their nerves and edged out Afghanistan by one wicket in a tense high-scoring second one-day international on Thursday.

No. 10 batter Naseem Shah (10 not out) edged seamer Fazalhaq Farooqi for a winning boundary off the penultimate ball as Pakistan reached 302-9 and got a decisive 2-0 lead in the three-match series.

Rahmanullah Gurbaz’s epic 151 and a meaningful 80 by his opening partner Ibrahim Zadran had earlier provided Afghanistan a formidable total of 300-5.

“All credit to the boys,” Pakistan captain Babar Azam said. “We just tried to build the partnership when me and Imam were playing, just wanted to play long and see where we stand after 40 overs. We knew we could chase 80 or 90 in the last 10 overs.”

Shadab Khan, who made 48 off 35 balls, brought Pakistan back in the chase off the last two balls in the penultimate over when he smashed two full tosses of fast bowler Abdul Rahman for a boundary and a six.

Needing 11 off the final over, Farooqi ran out Shadab at the non-striker’s end as the batter moved out of his crease before the bowler had bowled. But Shah and No. 11 Haris Rauf kept their nerves and shattered Afghanistan’s dream to beat Pakistan for the first time in an ODI.