The three-match series is tied at 1-1.
Azhar edged medium pacer Colin de Grandhomme through the slips for his ninth boundary to complete his first century after 18 barren innings.
Azhar, whose last hundred was against the West Indies in Dominica in May 2017, took 210 balls to reach the three-figure mark.
He has so far stuck 10 boundaries while Shafiq has seven in his 22nd half-century.
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 Sheikh Zayed Stadium pitch.
Boult has figures of 2-54 while fellow paceman Tim Southee has taken 1-39. AFP PDS
(This story has not been edited by Devdiscourse staff and is auto-generated from a syndicated feed.)