ABU DHABI  – New Zealand beat Pakistan by four runs in a sensational finish to the fourth day in Abu Dhabi on Monday, taking a 1-0 lead in the three-match series.

Set 176 to win, Pakistan were bowled out for 171 with debutant left-arm spinner Ajaz Patel finishing with 5-59 and fast bowler Neil Wagner taking 2-27.

Azhar Ali top-scored with 65 while Asad Shafiq made 45.

Shafiq was caught behind to left-arm paceman Neil Wagner after lifting Pakistan from a perilous 48-3 since resuming at 37 without loss.

Before his dismissal, Shafiq passed a personal milestone of 4,000 Test runs, becoming the 11th Pakistani batsman to do so.

Shafiq and Azhar rescued Pakistan after high drama at the start of the day, when Pakistan lost three quick wickets in the space of just eight runs and as many balls.

Opener Imam-ul-Haq was trapped leg-before to a full length ball by left-arm spinner Ajaz Patel in the fifth over of the day. Imam made 27 with four boundaries.

His fellow opener Mohammad Hafeez then miscued a drive off leg-spinner Ish Sodhi’s next over and was caught in the covers for 10.

Haris Sohail followed three balls later, caught and bowled off a Sodhi full toss for four.