India was always a long way behind the run-rate required after being 28-1 after 10 overs — the slowest power play so far of the tournament — but started gaining momentum through the innings of Rohit Sharma (102), Virat Kohli (66), Rishabh Pant (32) and Hardik Pandya, who struck 45 from 33 balls.
After Pandya was out in the 45th over, after which India required 71 off 30 balls, Dhoni hit another boundary four balls later but didn't find the rope again until the penultimate over. By that time India needed 51 from 11 deliveries.
The 2011 World Cup-winning captain hit Chris Woakes for six off the first ball of the last over and India took 12 runs off the last six balls to cut the margin of defeat to 31. India's unbeaten run at the tournament ended, but it remained in second spot on the World Cup standings with two group games to play.
Of Dhoni's seemingly sedate 42 from 31 deliveries, India skipper Kohli said it came down to playing the conditions. He said Dhoni was trying to hit boundaries, but England was bowling too tightly. "It is up to the discussion with the two in there. It was just not coming off," Kolhi said. "It was not easy get to boundaries. We will have to sit down and assess."
England has revitalized its Cricket World Cup campaign with a 31-run victory over India at Edgbaston.
Eoin Morgan's team needed this win to stay in control of its own fate at the tournament, and once India captain Virat Kohli departed for 66 it always looked likely England would prevail.
India finished on 306-5 after losing the toss and watching England amass 337-7 with a first World Cup century from Jonny Bairstow (111) and Jason Roy returning from a hamstring injury with a 57-ball 66 in an opening stand of 160.
Ben Stokes smashed six boundaries and three sixes to lead the later charge with 79 from 54 as England, looking at a 400-plus total at one point, still managed to set India a record World Cup chase.
Not that it was always comfortable for England.
Kohli looked in typically superb form and shared a 138-run partnership with Rohit Sharma (102), who reached his century at a roughly run-a-ball rate and had hit 15 fours by that stage.
England moved back into fourth spot, one point ahead of Pakistan.
India remains second with a game in hand on its rivals but Kohli's team is no longer unbeaten.
England has got the wicket it really wanted and Virat Kohli is out for 66.
The India captain had only been dismissed once at Edgbaston in five previous innings. He was out after a 76-ball innings with seven fours when he sliced the ball to substitute James Vince at backward point off the bowling of Liam Plunkett.
Kohli's dismissal leaves India on 146-2 after 28.2 overs, in reply to England's commanding 337-7.
Captain Virat Kohli and opener Rohit Sharma have both scored undefeated half centuries to lead India to 120-1 at the halfway stage of its innings in reply to England's 337-7.
Kohli is on 63 off 70 balls, and Sharma has 57 in 71 deliveries.
Kohli has only been dismissed once at Edgbaston in five previous innings
England is bowling and fielding tightly, with no extras conceded after 25 overs.
Opener KL Rahul was caught and bowled by Chris Woakes for a nine-ball duck with the total at eight in the third over.
England has finished 337-7 in its 50 overs and set unbeaten India a victory target that no team has ever achieved in the Cricket World Cup.
But the 338 chase isn't entirely unprecedented. India and England both scored 338 in a tied World Cup game at Bangalore in 2011.
The highest-successful chase remains Ireland's 329-7 against England at Bangalore eight years ago, and the highest in this tournament is Bangladesh's 322 against West Indies in a seven-wicket win at Taunton.
England needs to win to maintain its chances of progressing to the playoffs and started perfectly with recalled Jason Roy (66) and Jonny Bairstow combining in a 160-run opening stand.
Bairstow posted his first century of the World Cup before he was out for 111 as India's bowlers hit back toward the end of the innings.
Joe Root contributed 44 and Ben Stokes scored 79 from 54 balls before he was out to Jasprit Bumrah in the last over.
Mohammed Shami finished with a five-wicket haul but was expensive in conceding 69 runs.
Eleven times Sheldon Cottrell has done his trademark "march and salute" at the World Cup, his tribute to his comrades in the Jamaican defense forces when he takes a wicket. It has drawn attention across the cricket world, and one or two mimics from other teams.
It's also caught the attention of West Indies coach Floyd Reifer, who wants to develop the group of leaders to carry cricket forward in the Caribbean.
Cottrell could soon be rising through the ranks.
Asked ahead of Monday's group game against Sri Lanka which players had stood out as potential future leaders, Reifer went through a list including wicketkeeper Shai Hope, batsman Shimron Hetmyer and then he came to Cottrell.
"Sheldon Cottrell — he's a solider, a true soldier as well," Reifer said, adding how much energy the 29-year-old left-arm paceman has brought to the team in the West Indies first seven games.
"Yes, we have some players that we've identified as future leaders."
The West Indies are out of contention with just three points and two games to go, but Reifer said they'll be using the game against Sri Lanka to start building for the future.
England might want to ask former captain Michael Vaughan to annoy another of its players.
Jonny Bairstow posted his first century of the Cricket World Cup in the 26th over as England reached 183-1 against India at Edgbastson.
His unbeaten 90-ball 100 contained six sixes and eight fours and came against a strong India attack.
Bairstow reacted angrily to former Vaughan's criticism during the week by claiming some people in England want the team to lose. Vaughan used social media to reply, saying "It's not the media's fault you have lost three games."
Jason Roy made an impressive return with a 57-ball 66, including two sixes and seven fours. He fell to Kuldeep Yadav after smashing the ball to long-on and being superbly caught by substitute Ravindra Jadeja, who was running to his left and diving. That ended an opening partnership of 160 which has set up England nicely in a game it needs to win.
Joe Root is 12 not out.
Normal service has been resumed for England.
Reunited openers Jonny Bairstow and Jason Roy have reached 112-0 after 16 overs, smashing four sixes and 14 fours between them in front of a subdued pro-India crowd.
Bairstow is 61 not out in 58 balls and Roy has a 38-ball 46. Roy survived a strong appeal in the 11th over with the total at 49-0 and England accelerated.
Roy missed three matches with a hamstring injury but has returned to help give England a perfect start in a game it must win to stay in control of its own fate at the tournament.
India's cricket team is shining in unusually bright English sunshine.
But it's nothing to do with the score. Virat Kohli's team has their new bright orange away jerseys on display.
India usually wears blue but so does host England, so Kohli's team had to make a rare change.
After five overs, England openers Jason Roy and Jonny Bairstow had led England to 28-0.
England skipper Eoin Morgan has won the toss and given recalled opener Jason Roy the chance to bat first against India in the crucial Cricket World Cup group game at Edgbaston.
England made two changes from its 64-run defeat to Australia on Tuesday. Heavy hitter Roy returns after missing three games with a hamstring injury, coming in for opener James Vince, who lasted two balls against Australia. Right-arm quick Liam Plunkett replaces spinner Mooen Ali in a tactical change.
Pace bowler Jofra Archer has overcome a side strain and will start against India.
On the eve of the game, Morgan said he was willing to take short-term risks with Roy and Archer but they would not play if there was any long-term danger to their health. At the toss Sunday Morgan said Roy was fit to play.
India made one change to the lineup that had a 125-run win over West Indies on Thursday. Rishabh Pant, a 21-year-old left-handed batsman, makes his tournament debut in place of Vijay Shankar, who has an injured toe.
England has won three of its last four ODIs against India but India is undefeated in their last three World Cup meetings, including a victory at Edgbaston in the 1999 edition.
Edgbaston is slightly overcast with occasional blue skies and sunshine. It's dry with temperatures of around 19 degrees Celsius (68 F). The wicket appears to be batting-friendly and not as spin-threatening as England feared.
England: Jonny Bairstow, Jason Roy, Joe Root, Eoin Morgan (captain), Ben Stokes, Jos Buttler, Chris Woakes, Liam Plunkett, Adil Rashid, Jofra Archer, Mark Wood.
India: Rohit Sharma, KL Rahul, Virat Kohli (captain), Rishabh Pant, Kedar Jadhav, MS Dhoni, Hardik Pandya, Kuldeep Yadav, Mohammed Shami, Yuzvendra Chahal, Jasprit Bumrah.
England plays India at Edgbaston on Sunday with the Cricket World Cup hosts unexpectedly fighting for survival in a tournament they started as favorites to win.
For second-place India, it's simple. Win in Birmingham and Virat Kohli's team joins Australia in the semifinals.
For fifth-place England, Eoin Morgan's team likely needs to beat India — which no team has done so far — and also defeat 2015 finalist New Zealand in its last group game on Wednesday to advance. Two wins in two games and England will be through.
A loss, however, takes England's fate out of its own hands and opens the door to fourth-place Pakistan, which is a point ahead of England but has played one more game, and sixth-place Bangladesh, which is a point behind England.
England likes playing at Edgbaston — it has won its last three ODIs there — and it last lost at the venue in 2014, against India.
Kohli also likes playing at Edgbaston, judging by his performances. He has been dismissed just once before in five previous innings there. His scores include 96 not out, 81 not out and 43.
The game is a 25,000-seater sellout which will be played in a raucous soccer-style atmosphere with India set to attract more fans than England. Interest in the match is intense in Birmingham with a fan zone set up in the city's Victoria Square.
More AP cricket: www.apnews.com/cricket and https://twitter.com/AP_Sports