New Zealand beat Bangladesh by four wickets on the fourth day of the second Test on Saturday to level the two-match series at 1-1 as Ajaz Patel ripped through the Asian side with six wickets before his batting colleagues secured victory.
Chasing 137 to win on a treacherous track at Mirpur's Shere Bangla Stadium after Bangladesh's Zakir Hasan hit a battling 59, the tourists rode on Glenn Phillips's unbeaten 40 and Mitchell Santner's 35 not out to prevail.
"It was a bit of scrap," New Zealand skipper Tim Southee said. "It's nice to come out on the right side of it.
"The guys trusted their ways. The way Phillips and Santner play, it's on the attacking side to the other players. And they did that."
Phillips was dropped on nought by skipper Najmul Hossain Shanto but maintained his composure after the Black Caps were reduced to 69-6 before tea to build a seventh-wicket stand of 70 and earn his team a first test win in Bangladesh in 15 years.
"We pride ourselves on fighting till the end and we did that," said man-of-the-match Phillips.
"Our spinners did incredibly well, also Tim. The Bangladesh boys came back with intent. To bring that back and to chase 137 was pleasing.
"The intent was there... Mitchell batted really well. He's got amazing hands, such a fluent player. Credit to him and all the boys."
Bangladesh had resumed on their overnight score of 38-2 but lost wickets cheaply in the morning as spinners Patel (6-57) and Santner (3-51) took advantage of the turn on offer to heap pressure on the batsmen.
Patel produced a double strike in the 25th over to get rid of Mehidy Hasan Miraz and Nurul Hasan and leave Bangladesh in deep trouble at 97-7 but opener Zakir, who was starved of the strike as wickets tumbled at the other end, soldiered on.
Zakir took Bangladesh past the 100-run mark and then brought up his half-century to muted celebrations before hitting Santner for a huge six, but the left-hander became Patel's fifth victim when he miscued a sweep.
The hosts were dismissed for 144 before lunch in what was effectively the third day of a rain-affected contest in which an entire day was lost.
New Zealand had dragged themselves back into the contest on Friday thanks to a fighting 87 by Phillips that gave them a slim eight-run lead after Bangladesh made 172 in their first innings.
"The bowlers did a great job. Everyone chipped in the field as well," said Shanto. "There was an opportunity to win. I hope we learn from this match."
Bangladesh won the opening match by 150 runs in Sylhet for their first test victory on home soil against New Zealand.
They travel to New Zealand for three one-day internationals and as many Twenty20 matches this month.