Bangladesh kept their Champions Trophy hopes alive in Cardiff on Friday as they eliminated New Zealand.
New Zealand inns: 265-8 (50/50 overs. Taylor 63, Williamson 57; Hossain 3-13, Ahmed 2-43)
Bangladesh inns: 268-5 (47.2 overs. Al Hasan 114, Mahmudullah 102*; Southee 3-45)
Bangladesh won by five wickets
Bangladesh produced another Cardiff victory every inch as remarkable as the 2005 triumph over Australia to keep their Champions Trophy hopes alive and eliminate New Zealand.
Needing 266 to beat the Black Caps and remain in with a chance of a semi-final spot, Bangladesh's reply was close to ruins after being reduced to 33 for four in the 12th over.
But Shakib Al Hasan (114) and Mahmudullah (102 not out) combined to produce the greatest partnership in Bangladesh limited-overs history.
It eclipsed the 178 shared by Tamim Iqbal and Mushfiqur Rahim against Pakistan in 2015, and was the second highest partnership in Champions Trophy history.
A dozen years after their first win over world champions Australia came at Cardiff, the pair put on 224 in 219 balls as Bangladesh turned potential embarrassment into a five-wicket win with 16 balls to spare.
The scenario of this penultimate Group A match was straightforward.
The winner would have to wait on the outcome of Saturday's clash between England and Australia to determine whether a semi-final spot had been secured.
The loser would head for home with only one point from three games, and that appeared Bangladesh's fate after Tim Southee had ripped through the top of their batting order.
New Zealand had suffered a familiar batting collapse on their way to posting 265 for eight from their 50 overs, but Trent Boult had promised before the game that the Kiwi bowlers would adopt an aggressive approach.
Boult and new-ball partner Southee backed up those words as Tamim, in destructive form at this tournament with scores of 128 and 95 against England and Australia, fell lbw to the second ball of the innings.
Tamim had no answer to a delivery which straightened on him and was shown to be hitting the stumps after Bangladesh had asked for a review.
Southee then detected the edge of Sabbir Rahman's bat to claim his 159th victim in ODI cricket and take him past Sir Richard Hadlee and up to sixth on New Zealand's all-time list of leading wicket-takers.
But he was not finished there as Soumya Sarkar was beaten by one which jagged back and struck in front to leave Bangladesh 12 for three.
Boult should have got in on the act when Ross Taylor, injuring himself in the process, spilled Mushfiqur's hard edge to slip.
Mushfiqur was soon castled by Adam Milne for 14 and the noisy Bangladesh support had fallen silent.
But they rediscovered their voices as Shakib and Mahmudullah set off on the most unlikely of run chases.
The pair played beautifully in finding the gaps, running hard and taking on the boundaries when the big shots were there to be played.
Even arm cramps could not disturb Shakib, who called for the physio twice but continued to complete his hundred with a first six of the innings.
Mahmudullah also reached three figures as Bangladesh closed in on victory and New Zealand were ragged by the end, with 17 wides adding to their misery.
Earlier, New Zealand had been well-poised at 152 for two with Kane Williamson and Taylor supplying further mid-innings stability after partnerships of 95 and 99 against England and Australia.
But New Zealand have repeatedly folded after the departure of skipper Williamson, losing seven wickets for 37 runs against Australia and eight for 65 in defeat to England.
This time, after Williamson had made his lowest score of the tournament - 57 from 69 balls - New Zealand lost six wickets for 103 as Mossadek Hossain (three for 13) and Taskin Ahmed (two for 43) led a spirited Bangladesh bowling unit.
Taylor top-scored with 63 from 82 balls, but it is Bangladesh who now hope England can beat Australia at Edgbaston to secure their own progress to the last four.
Bangladesh skipper Mashrafe Mortaza on reaching the semi-finals if England beat Australia: "That will be nice (if England win), but we can't just expect Australia to lose that game.
"I would like to say the best of luck to both teams, because whatever we could do we did. That is most important for us.
"Obviously I would like to go to the semis and if we do we will hopefully play better cricket than in the last three matches.
"We have to wait now, but in the last three years we keep improving a lot.
"This sort of performance really help us to move forward, especially with the 2019 World Cup coming up. It will really boost the team."
On beating New Zealand: "We thought 266 was gettable, but after 33 for four it becomes very hard.
"Once the partnership got to a hundred I knew those two could make a difference.
"They've done it a lot of other times, but it was phenomenal to get a 200 partnership.
"We know Tamim can not get a score every time, but we have got some excellent players who can win games."
New Zealand skipper Kane Williamson on their batting collapse: "With the position we were in, closer to 300 would have been a much better total.
"But after the start we had with the ball we thought 265 was going to be enough.
"We've defended that score in the past and we thought it was achievable.
"But to get a 200-plus partnership under that pressure was simply superb from Bangladesh."
On a winless tournament: "You want to come here firing and playing the best cricket.
"We showed some signs of that against Australia, but we certainly haven't seen that in our last two games in Cardiff.
"We've got to use this experience to be better as a unit and as individuals, because you are going to be put under pressure in these tournaments."