|ICC Men's Cricket World Cup, Hampshire Bowl, Southampton|
|India 224-8 (50 overs): Kohli 67, Jadhav 52, Nabi 2-33|
|Afghanistan 213 (49.5 overs): Nabi 52, Shami 4-40, Chahal 2-36|
|India won by 11 runs|
|Scorecard; Table; Schedule|
Mohammed Shami's hat-trick denied Afghanistan a historic and shock World Cup victory over India in Southampton.
India looked in danger of losing when Afghanistan struck a boundary off the first ball of the final over to move to within 12 runs of victory.
However, Shami had Mohammad Nabi caught on the boundary for 52 before demolishing the stumps of numbers 10 and 11 with searing yorkers.
Defeat eliminates Afghanistan, while India move above England into third.
India had earlier posted 224-8, with Virat Kohli top-scoring with 67 on a slow pitch.
Afghanistan, who had never beaten India and whose only previous World Cup win was against Scotland in 2015, gamely worked their way towards victory but were heavily reliant on Nabi after a middle order wobble saw them fall from 106-2 to 166-6.
Nabi successfully overturned an lbw decision in the 48th over and managed to take his side to within two blows of victory before Shami's thrilling intervention.
"You can see what it has meant to the Indian players," said former England captain Alec Stewart on Test Match Special.
"They were odds-on favourites by a country mile. Going into the last over we didn't know who was going to win.
"As the last wicket fell all of their players came together. What a game of cricket."
|World Cup group table|
Top four go through to semi-finals
So near yet so far for Afghanistan
After Friday's shock win for Sri Lanka over England, it appeared India were going to be the second of the favourites for a semi-final place to stumble.
However, with Afghanistan well placed on 106-2 after a number of solid if unspectacular contributions, India captain Kohli sensed the game was getting away from his team.
He introduced Jasprit Bumrah - the world's number one rated one-day bowler - and saw Afghanistan's two set batsmen, Rahmat Shah (36) and Hashmatullah Shahidi (21), dismissed in the space of three balls.
Shah was well caught by Chahal running in from fine leg before Hashmatullah tamely chipped back to Bumrah.
Nabi intelligently shepherded the lower order towards their target as a loud and mainly Indian-supporting crowd fell silent.
Shami, though, kept his nerve in a devastating final over which began with a boundary, was sandwiched by Hardik Pandya's cool catch of Nabi at long-on, and ended with the most devastating of knockout blows via stump-splattering yorkers.
Kohli top-scores for ponderous India
India's innings was curious after both captains had stated their preference for batting first at the toss.
Five of India's top six made starts - Rohit Sharma the only one to fail when he played down the wrong line to Mujeeb Ur Rahman - but none could convert to a match-defining score.
Perhaps the only player to truly read the pitch was Kohli, who was nimble on his feet and decisive with his strokemaking.
When not punching straight down the ground, he drove gloriously through the covers - splitting the field with precision.
It was almost a surprise when he misjudged the bounce of a Nabi off-break and cut straight to Rahmat Shah at gully.
MS Dhoni - as is often the case - trundled along at his own pace, batting the ball back to the bowler as the crowd began to get restless; chanting his name and hinting that it was time to go through the gears.
Only Kedar Jadhav was truly able to find the boundary regularly, though, with India's solitary six being stylishly lifted back over the bowler's head with one hand off the bat by the stocky right-hander.
Six Afghanistan bowlers were used and all six took at least one wicket, with Gulbadin Naib's side once again impressing in the field.
In their six games so far, they have dropped just two catches compared to the tournament's worst offenders, England's 11.
'We showed character' - what they said
Afghanistan captain Gulbadin Naib: "We bowled really well. We did well in batting, credit to Bumrah for how he bowled in the last two or three overs.
"The total was not that much but in the middle you need 80s or 100s. 30 or 25s are not enough. If you chase 250 then middle order batsmen should go longer and take responsibility."
India captain Virat Kohli: "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."
BBC Afghanistan correspondent Emal Pasarly: "I am emotional but it was a great game. All of the Afghanistan fans wanted the team to fight and they did fight today. That is the main thing.
"Afghanistan will get a lot out of this game. If they can take this to the Bangladesh game it will be even closer."