(CNN) -- Bangladesh pulled off one of the big upsets of the 2011 Cricket World Cup by beating England by two wickets in a thrilling Group B match at Chittagong on Friday.
The co-hosts kept alive their hopes of qualifying for the quarterfinals and left England in danger of crashing out of the tournament following a second defeat in five matches.
The English must now win their final game next Thursday against the West Indies, who earlier survived a scare before beating Ireland and have an extra game to play against unbeaten India.
Bangladesh also have two matches left, against fellow minnows the Netherlands on Monday and then heavyweights South Africa on March 19, and will qualify in the top four with wins in both.
England posted a disappointing total of 225, being bowled out in the final of the allotted 50 overs as Naeem Islam, Abdur Razzak and captain Shakib Al Hasan took two wickets each.
Jonathan Trott top-scored with 67 while Eoin Morgan, playing his first match since replacing the injured Kevin Pietersen, contributed 63.
Bangladesh had been bowled out for 58 by the Windies last Friday, but appeared to be cruising to a famous victory at 155-3 in the 31st over.
However, opening batsman Imrul Kayes was needlessly run out for 60, Al Hasan (32) dragged a delivery from spinner Graeme Swann onto his stumps, then seam bowler Ajmal Shahzad dismissed Mushfiqur Rahim and Islam (0).
Razzaq fell to Swann three runs later at 169-8, but Shafiul Islam joined Mahmudullah and gave Bangladesh hope.
Islam hit four fours and a six as he scored 24 off as many balls faced, while Mahmudullah made a dogged 21 off 42.
The tide turned in the 46th over when England swing bowler James Anderson conceded 11 runs, including seven wides.
Islam then hit two boundaries in Tim Bresnan's next over to bring the target down to 12 runs from 18 balls, and Mahmudullah hit the same bowler to the boundary with the last delivery of the 49th to give Bangladesh a second win in 15 meetings with the three-time World Cup runners-up.
"I thought Mahmudullah and Shafiul batted exceptionally well. At one stage we thought we'd lost the game but they showed their character, how tough they are and how hard-working," Al Hasan told AFP.
Ireland also beat England earlier this month, and had been on target to follow that up with a win over the West Indies at Mohali until a controversial umpiring decision turned the game.
The Windies had posted a total of 275 as opener Devon Smith scored his first century in one-day internationals, going on to make 107, and all-rounder Kieron Pollard smashed 94 off 55 balls -- hitting eight fours and five sixes.
Pollard also pulled off a fine catch to dismiss dangerman Kevin O'Brien, Ireland's match-winner against England, but the Irish needed just 76 runs to win off the last nine overs with half their wickets remaining when Gary Wilson was given out for 61.
Sri Lankan umpire Asoka de Silva ruled that Wilson had been trapped leg before wicket by Darren Sammy, and the batsman's call for a second review was unsuccessful even though it appeared that he should not have been given out.
Ireland then lost their last four wickets cheaply as left-arm spinner Sulieman Benn finished with 4-53 alongside Sammy's earlier three strikes as the Windies moved up to second place, a point above England.
In Saturday's only game, India face South Africa in Nagpur, while Sunday sees Group B matches between Canada and New Zealand, then Australia and Kenya.