Mahmudullah and Shakib Al Hasan shared a superb 224-run partnership to lead Bangladesh to a memorable five-wicket victory over New Zealand who were knocked out of the Champions Trophy on Friday.
Chasing 266 to win the Group A game, Bangladesh slumped to 33 for four as Kiwi seamers Tim Southee, Trent Boult and Adam Milne made the new ball swing.
Opener Tamim Iqbal, who had scored 128 and 95 in his last two innings, was trapped lbw for nought by Southee in the first over.
The 28-year-old Southee ran through the Bangladesh top order, dismissing Soumya Sarkar (3) and Sabbir Rahman (8) before Milne removed Mushfiqur Rahim for 14.
But Mahmudullah and Shakib produced a vintage batting display, keeping the required run rate under control as they put together the first 200-run stand for Bangladesh in one-day internationals.
Shakib reached his hundred with a massive six in the 46th over before Boult removed him for 114 and Mahmudullah finished on 102 not out to guide Bangladesh home with 16 balls top spare.
New Zealand captain Kane Williamson won the toss and opted to bat after the match was delayed by an hour due to rain.
Bangladesh fast bowler Taskin Ahmed made an early breakthrough when Luke Ronchi gave a catch to mid-on with 46 runs on the board.
Williamson (57) and Ross Taylor added 83 runs for the third wicket before the skipper was run out after being sent back attempting to sneak a quick a single.
Ahmed returned to the attack to dismiss Taylor who made 63 off 82 deliveries.
Part-time off-spinner Mosaddek Hossain stunned the Kiwi middle-order, removing Neil Broom (36), Jimmy Neesham (23) and Corey Anderson, who was trapped lbw for a first-ball duck. New Zealand managed just 62 runs in the final 10 overs, the lowest tally by any team in the this year's tournament.
Bangladesh moved up to second in the standings and will qualify for the semi-finals if Group A leaders England beat third-placed Australia on Saturday.