Fast bowler Neil Wagner was hailed as an "inspiration" on Wednesday after he shrugged off the pain of two broken toes to help bowl New Zealand to victory in the first Test against Pakistan. A Shaheen Afridi yorker fractured the toes in Wagner's right foot during New Zealand's first innings but, surviving on painkilling injections and grit, he bowled 21 overs in Pakistan's first innings and 28 in the second for a match haul of four wickets. Wagner crucially removed Fawad Alam for 102 during a marathon 11-over spell late on the fifth day to snuff out Pakistan's hopes of a surprise victory. New Zealand eventually won by 101 runs, 27 balls from the close. New Zealand captain Kane Williamson said it was an incredible performance, although Wagner's heart was well known within the team. Pakistan skipper Mohammad Rizwan said: "I just told him [Wagner] he's mad. He's a different guy. His attitude is everything, his aggression is very beautiful." Pakistan batsman Azhar Ali described his "huge respect" for Wagner. "I said that to him – that's what it means to play for your nation," Azhar said. "I think he's showing that and he's an inspiration, everyone knows he's got not one, but two, broken toes and he's fighting for his team. "He was giving 100 per cent and maybe more than that, so I have a huge respect for him." Williamson said trying to get the most out of Wagner before the painkillers wore off was a unique situation. "People talk about the size of his heart in terms of what he [normally] does on the cricket field but to have a couple of broken toes, and he's in a lot of pain and going off to get injections and numbing his foot, and we're trying to use him," Williamson said. "It was very, very special from 'Wags', one the team appreciated. We needed him out there and he delivered." The win tentatively put New Zealand top of the World rankings and kept alive their chances of making the World Test Championship final. After a 165-run fifth-wicket stand by Alam and Mohammad Rizwan the Test went into the final session with both sides in with a chance to win. Pakistan needed 158 runs, New Zealand required six wickets and 36 overs remained. When Kyle Jamieson had Rizwan lbw for 60 and Wagner removed Alam for 102, New Zealand were into the tail as Pakistan folded from 240-4 to be all out for 271. Tail-enders Afridi and Naseem Shah kept the draw option alive as long as they could, blocking for seven overs in fading light before Naseem was caught and bowled by spinner Mitchell Santner for one, ending Pakistan's resistance. "We saw an incredible spell from Kyle and Wags together that did turn the match when it was looking likely to run out into a draw," Williamson said, adding that with so much at stake he could not contemplate going defensive. "For us it was trying to win at all costs. Going into that last session we still clearly had that opportunity, as did Pakistan, but in the context of the Test championship losing while trying to win was still a better bet than anything else. "It was great coming away with the result and the excitement of finishing so late in the piece obviously adds to that."