Mohammed Shami's last-over hat-trick saved India from a mighty scare as they managed to pip Afghanistan by 11 runs to inch closer towards World Cup semi-finals, as brilliant death bowling compensated for an inexplicable batting display on Saturday.

Shami (9.5-1-40-4), playing his first match, not only successfully defended 16 runs off the last over but also dismissed the dangerous Mohammed Nabi (52 off 55 balls), Aftab Alam (0) and Mujeeb ur Rahman (0) off successive deliveries to complete the rare feat.

Afghanistan were bowled out for 213 in pursuit of a manageable 225 run target which at one stage looked gettable after the Indian middle-order flopped in their first World Cup test.

It was superb death bowling by Jasprit Bumrah (2/39 off 10 overs) and Shami that changed the complexion of the game. As much as Shami deserves the credit, Bumrah deserves equal plaudits for giving five runs in the penultimate over.

The pitch being a tricky one, a target of 225 against a quality bowling attack wasn't going to be easy. There were partnerships but there was always this belief that Afghanistan batting won't be able to sustain the pressure.

Bumrah was lethal as ever and his two wickets in the 29th over literally tilted the game before the minnows made another comeback. From a relatively comfortable 106 for 2, it became 106 for 4 with Afghanistan losing the momentum.

But Nabi (52) had other ideas as he tried his best but that 'exclusive 60 plus stand' that is mandatory in these kind of chases didn't happen.

The Indian spinners Yuzvendra Chahal (2/36 in 10 overs) and Kuldeep Yadav (0/39 in 10 overs) were remarkably consistent with their lines as they never really let the batsmen get away.

Earlier, skipper Virat Kohli (67 off 63 balls) again batted effortlessly before Afghanistan's IPL stars Mohammed Nabi (9-0-33-2), Mujeeb ur Rahman (10-1-26-1) and Rashid Khan (10-0-38-1) put brakes on India's other star batsmen, keeping them under tight leash on a slow track that offered both turn and bounce.

It was a glorious comeback by Afghanistan bowlers, as Indian batsmen played 152 dot balls (equivalent to 25.2 overs). This was after being hit for a record 25 sixes by England in the previous game.

Mahendra Singh Dhoni (28 off 52 balls) and Kedar Jadhav (52 off 68 balls) were unable to accelerate against the slow bowlers adding only 57 runs in 14 overs during the middle phase.

Dhoni's inability to rotate strike during middle overs and Kedar's lack of game time was evident as they could never really force the pace. Worse, they didn't even intend to take any risk against the three spinners.

While the odd ball was holding up and there was some turn available, at times, Kedar and Dhoni were even defending fuller deliveries.

The intent was missing and suddenly they were trying to play out the overs bowled by Mujeeb, easily the best of the lot with 38 dot balls to his credit.

Dhoni was finally relieved from his miseries by Rashid as the desperate former skipper came down the track and was stumped. This was only the second time in his career and first time since 2011 that Dhoni was stumped.

The amount of pressure that the duo put on Hardik Pandya was evident as he was forced to slog from ball one but failed to deliver this time getting out to pacer Aftab Alam.

Skipper Gulbadin Naib (2/51) also impressed with his seam-up stuff dismissing Kedar off the penultimate delivery of the innings.

Before this game, India lost 14 wickets in the three completed games and none of the wickets went to the spinners.

It started with India's in-form opener Rohit Sharma being beaten by a doosra from Mujeeb as he lunged forward for a defensive stroke.

KL Rahul despite scoring 30 could never really get the measure of Mujeeb, his Kings XI Punjab teammate.

The itch to outsmart Nabi cost Rahul dearly as he tried a reverse sweep only to find Hazratullah Zazai at short third-man after a 57-run stand with Kohli.

Kohli never looked in trouble and hit one beautiful cover drive off Rashid. Vijay Shankar (29 off 41 balls) nudged around and was steady during their 58-run stand before being adjudged leg before by Rahmat Shah.

Kohli looked good for another hundred but missed three in three games, trying to cut Nabi with the turn. Once Kohli was out, the Indian innings lost momentum.