Tamim, who smashed 17 fours in his entertaining 153-ball knock, put on 76 with Mominul Haque (47) for the third wicket and 67 with Marshall Ayub (41) for the second wicket.
Trent Boult gave New Zealand their first breakthrough when Anamul Haque (seven) miscued a pull shot and Kane Williamson took the catch.
Ayub looked solid until Wagner, who replaced left-arm spinner Bruce Martin in New Zealand's line-up from the drawn first Test, broke through his defence and bowled him.
The right-handed Ayub struck six well-executed boundaries in his 62-ball innings.
Corey Anderson induced an edge from Mominul Haque to leave him caught behind.
Tamim survived two drop catches at the start of the innings.
Wicketkeeper Bradley-John Watling dropped the left-hander on five before skipper Brendon McCullum let him off at second slip at 10. Doug Bracewell was the unlucky bowler on both occasions.
Bangladesh made one change to their squad that played in the drawn Test in Chittagong, bringing in uncapped paceman Al Amin Hossain for injured Robiul Islam.