Shafiq made a steady 104 and Azhar notched a solid 134 as the duo punished New Zealand during their relentless 201-run stand for the fourth wicket which helped Pakistan overhaul New Zealand's total of 274 on the third day of the final Test in Abu Dhabi.
At the break, Babar Azam was unbeaten on 14 and skipper Sarfraz Ahmed was batting on one and Pakistan still have five wickets to further their lead and secure victory in a three-match series currently tied at 1-1.
Azhar edged medium pacer Colin de Grandhomme through the slips for his ninth boundary to complete his first century since he notched one against West Indies in Dominica in May 2017 and his first ever hundreed against New Zealand.
He took 210 balls to reach the three-figure mark, smashing 12 boundaries during his 297-ball knock Shafiq completed the 12th hundred of his career with a sharp single off Somerville before falling leg-before to Patel off a straight delivery.
He hit 14 boundaries in his 259-ball innings.
Azhar and Shafiq frustrated New Zealand's search for early wickets as they took Pakistan to 224-3 at lunch.
New Zealand skipper Kane Williamson took the second new ball in the 81st over with Pakistan comfortably placed at 213-3, but nothing worked for the bowlers on a flat pitch at the Sheikh Zayed Stadium.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)