Virat Kohli and Kedar Jadhav defended India despite a worrying showing against Afghanistan in which they limped to victory.
India failed to impress with the bat after scoring 224-8 in their 50 overs, with captain Virat Kohli top-scoring with a 67.
On a slow pitch at Southampton, India looked in danger of losing in what was a dramatic finish on the south coast.
Afghanistan’s Mohammad Nabi starred with the bat and scored 52, forcing the match into the final over before moving his team to within 12 runs of victory.
However, he was caught on the boundary before Shami dismissed Aftab Alam and Mujeeb Ur Rahman in consecutive balls.
India remain third in the World Cup standings and Kohli was pleased with the fight shown by team.
He told BBC Sport: “This game was important for us. It didn’t go as planned. When things don’t go your way you need to show character and bounce back.
“That showed the character of our team. We can take lot of heart from this win and take the confidence forward.”
Kedar Jadhav, who hit 52 for India, defended their middle order: “When I went in to bat I felt the wicket was not on the flatter side.
“The ball was not coming that easily onto the bat so we had to take our time. And they had two or three quality spinners.
“And that doesn’t help when the wicket is slow.
“I think we can definitely improve on this, but I don’t see any other team having three or four quality spinners.”
Steve Smith couldn’t get a hundred today. The Badger could.
England get Steve Smith out for just 80. Great success.
England are utterly infuriating, they really are.
Joe Root > Don Bradman. That’s just maths.
Joe Denly with more runs in a day than Warner in the whole series there.
Changes for both teams ahead of The Oval.
England’s Test-match batting is broken. Time to get back to basics.
The WTC scoring system is stupid, but the fix is easy. Get it done.
The Badger lets off steam.
Joe Root is shepherding the ‘righteous’ England team through ‘the valley of darkness’ and must ‘lay his vengeance’ upon those closest to him