Chasing 289 to win, the co-hosts overcame a late collapse to win with seven balls to spare, with Martin Guptill scoring 105, Ross Taylor 56 and Grant Elliott 39.
Bangladesh had posted 288-7 in Hamilton as Mahmudullah made an unbeaten 128, his second century in two matches.
New Zealand, who remain unbeaten, had already secured top spot in Pool A. The Kiwis, who have lost six World Cup semi-finals, will face Pakistan, Ireland or West Indies in the quarter-finals in Wellington on Saturday, 21 March.
They showed why they are one of the favorites to win the competition with a hard-fought victory after they won the toss.
In a thrilling finish, New Zealand fell from 210-3 to 269-7 as Bangladesh captain Shakib Al Hasan claimed 4-55, but Daniel Vettori and Tim Southee saw the hosts home after a rapid 39 from Corey Anderson.
Defeat means Bangladesh are likely to finish fourth in Pool A, which would mean a quarter-final against Pool B winners India in Melbourne on Thursday, 19 March.