Bangladesh 268 for 5 (Shakib 114, Mahmudullah 102*, Southee 3-45) beat New Zealand 265 for 8 (Taylor 63, Williamson 57, Mosaddek 3-13) by five wickets
Scorecard and ball-by-ball details
The world called it the mother of all miracles when little Bangladesh beat the mighty Australians in Cardiff in 2005. Twelve years later, in a toe-to-toe battle with New Zealand at the same ground, Bangladesh staged a comeback for the ages, winning by five wickets after being blown away by their pace attack. The stunning turnaround was scripted courtesy Bangladesh's highest stand for any wicket in ODIs between centurions Shakib Al Hasan and Mahmudullah who added 224 at over a run a ball after their side had been reduced to 33 for 4 chasing 266.
All of Bangladesh will now back England to beat Australia or pray for a washout in Edgbaston for them to reach the Champions Trophy semi-finals in their return to the tournament after 11 years.
Bangladesh had lost their top order by the 12th over and looked on their way out of the tournament in what was a must-win for both teams. But that was as far as New Zealand's success went. For the umpteenth time, Shakib confirmed his status as the premier allrounder in world cricket with an almost run-a-ball 114; Mahmudullah finished not too far behind, hitting 102 not out off 107 - he brought up his third ODI ton with a hook off Trent Boult.
The Shakib-Mahmudullah stand went past the 178-run Tamim Iqbal-Mushfiqur Rahim stand against Pakistan in 2015 to set a new record for Bangladesh. It was Shakib's seventh ODI hundred, and he got there by helping the pacy Adam Milne over fine leg for six in the 46th over. By the time his stumps were breached, Bangladesh were just nine runs short. The New Zealand fielders standing nearby congratulated him before he walked off, even as the whole ground stood up to applaud.
New Zealand wouldn't have imagined it would come down to this when they struck four early blows. After a difficult final 10 overs of their batting innings, Tim Southee and Boult combined brilliantly to give them a dream start with the ball. Boult produced plenty of late moving deliveries that drew "oohs" and "aahs" from the crowd, while Southee made the inroads - he removed Tamim, Sabbir Rahman and Soumya Sarkar in his first three overs.
Tamim was trapped lbw in the first over, with the ball jagging back, while Sabbir nicked a late-moving outswinger with the score on 10. Soumya was undone by another delivery that skidded in sharply; replays suggested that it would have gone over the stumps but Tamim had used up Bangladesh's review. Birthday-boy Mushfiqur got hit on the fingers and was also dropped by Ross Taylor at slip on four, before Adam Milne's 146kph thunderbolt blew out his middle stump in the 12th over.
All seemed lost at this point. But in Shakib and Mahmudullah, Bangladesh found quite the rearguard. Neither does defensive cricket too well, and they duly began with a counterattacking four each in the 13th over. Mahmudullah brought out some audacious shots, blasting Neesham over midwicket for a big six and following up with a dinky pull next ball. Not long after, he ramped Corey Anderson.
Shakib brought up his fifty and the century partnership in the 29th over with one of his trademark strolled singles to third man, very Arjuna Ranatunga-like. Mahmudullah, the more elegant of the two, reached his fifty in the 31st over before lifting Kane Williamson over long-on for six. Soon the target was down to double digits.
There was a brief lull after the equation was down to 70 off the last 10 overs, but Shakib and Mahmudullah opened up again with cuts, chips, full-blooded drives and an upper-cut to bring the asking rate down to below a run a ball. A single in the 45th over made Shakib and Mahmudullah the first Bangladesh pair to have a 200-run partnership in an ODI.
The winning moment came when Mosaddek Hossain, Bangladesh's hero with the ball, flashed a boundary through third man off Milne. The scenes of the batsmen celebrating and their team-mates screaming in sheer delight from the balcony were a flashback to 2005 when they slayed Ricky Ponting's men.
With the ball, Bangladesh had once again proven miserly in the slog overs, conceding just 62 runs in the last 10 overs and picking up four wickets. It derailed New Zealand's effort as part-time offspinner Mosaddek, brought on as late as the 42nd over, took three of those wickets. Mosaddek removed a set Neil Broom as well as the big-hitters Anderson - for a golden duck - and Neesham in the space of 18 deliveries.
Mashrafe and Bangladesh however had to ride out some efficient New Zealand batting leading up to the 40th over. Martin Guptill and Luke Ronchi got them off to a quick start, before Williamson and Taylor took over. The captain and Taylor added 83 runs for the third wicket. Both got fifties; Williamson's was his third score over fifty in three games in the tournament.
But then New Zealand's lower-middle order unravelled liked it had done against Australia and England. While Mosaddek had the best figures, Rubel Hossain and Taskin Ahmed bowled well at both ends of the innings - the first 10 overs and the last 10.
This efficient bowling performance was backed by astute captaining by Mashrafe, and made sure New Zealand did not get away to a total that was out of reach. From then on it was the Shakib and Mahmudullah show.

Mohammad Isam is ESPNcricinfo's Bangladesh correspondent. @isam84