Pakistan were pushed all the way by Afghanistan in the first-ever Twenty20 international between the two nations on Sunday, but eventually secured a six-wicket triumph off the final ball of the match.
Having won the toss and batted first, the Afghanis set their opponents a challenging target of 138 in Sharjah and Pakistan were indebted to captain Mohammed Hafeez who steered his side home with a cool knock of 42 not out from 37 balls.
Afghanistan made a poor start to their innings and had lost both openers Mohammad Shahzad (two) and Nawroz Mangal (one) by the fifth over.
Najibullah Zadran (38) and Mohammad Nabi (15) then steadied the ship as they put on 35 for the fourth wicket in good time, although the introduction of left-arm paceman Junaid Khan saw the runs dry up somewhat.
Khan did for Samiullah Sinwari (16) and Najibullah - who hit three fours and two sixes - in quick succession and also removed Dawlat Zadran for a first-ball duck to finish with excellent figures of 3-24 from his four overs.
Mirwais Ashraf provided some late impetus with an unbeaten 28 off 22 balls to take Afghanistan to 137-8 - their highest score against a Test playing nation.
Pakistan got off to a solid start with an opening stand of 47 between Ahmed Shehzad (35) and debutant Sharjeel Khan (18) by the eighth over.
Shehzad - who hit six boundaries during his 37-ball knock - holed out in the deep, while Sharjeel miscued a drive off Mohammad Nabi to leave Pakistan at 64-2 just before the halfway stage.
Hafeez and Umar Akmal (28) then put on a partnership of 47 for the third wicket to take them within 37 of their target before the latter departed in the 17th over after being bowled by Dawlat Zadran.
But Hafeez kept his cool and, with six needed off the final over, victory was achieved with a wide off the last ball of the match.