Gazi followed a maiden test century on Saturday by taking six for 77 in New Zealand's second innings of 287 for seven declared. (Agencies)
Bangladesh, set 256 to win from 45 overs, were 173 for three when play was called off. It was the second draw only between the two teams with New Zealand winning the other eight.
Although a draw was always the likely result after the fourth day had been curtailed by rain, both teams did their best to force a result at the Zahur Ahmed Chowdhury Stadium.
Resuming their second innings on 117 for one, a lead of 85, Peter Fulton (59) and first innings century maker Kane Williamson (74) completed half-centuries before Gazi struck.
He dismissed Corey Anderson lbw for eight and wicketkeeper BJ Watling edged the next delivery to wicketkeeper Mushfiqur Rahim, who juggled the ball before taking the catch.
Gazi, playing in his seventh test, then fooled Doug Bracewell with an arm ball that the batsman nicked on to the pad of Mushfiqur. Shakib Al Hasan dived from first slip to take a one-handed catch and complete the hat-trick.
Gazi followed a maiden test century on Saturday by taking six for 77 in New Zealand's second innings of 287 for seven declared.