Bangladesh looked to be closing in on a shock victory over world Test champions New Zealand after Ebadot Hossain's three-wicket burst in the final session of the fourth day reduced the hosts to 147/5 in the opening match in Mount Maunganui on Tuesday.
After four of Bangladesh's top six batsmen struck fifties to earn them a first-innings lead of 130, Ebadot (4/39) wrecked New Zealand's top order to put the tourists on the verge of a major upset despite their poor catching on the penultimate day.
Ross Taylor, playing his last Test series, was batting on 37 with all-rounder Rachin Ravindra on six at the other end.
Earlier, Bangladesh resumed on 401/6 and the lower order batted 20-odd overs before being all out for 458 in the first match of the two-Test series.
Mehidy Hasan made 47 while Trent Boult (4/85) and Neil Wagner (3/101) claimed the bulk of the wickets for the hosts.
Bangladesh returned to claim two wickets in the second session to put New Zealand under pressure.
Leading the side in the absence of the injured Kane Williamson, Tom Latham dragged a delivery from Taskin Ahmed onto his stumps to depart for 14.
Ebadot removed Devon Conway for 13 and it could have been a full-blown crisis for New Zealand had Liton Das not spilled Will Young, then on 31, after off-spinner Mehidy had produced an edge.
Mehidy suffered more heartbreak when he induced a slog-sweep from Taylor but Shadman Islam floored the catch at square leg.
New Zealand had just erased the deficit when Ebadot dismissed Young (69) and Henry Nicholls for a duck in the same over.
Tom Blundell also went for a duck in Ebadot's next over as Bangladesh put themselves in the box seat.