India's Mohammed Shami took a hat-trick in the final over to deny Afghanistan at the Cricket World Cup ©Getty Images

India's Mohammed Shami took a hat-trick in the final over to deny Afghanistan a famous victory at the Cricket World Cup in England.

Afghanistan looked on course to spring perhaps the biggest World Cup shock when they scored a boundary to reduce the amount of runs they required to 12 at Hampshire Bowl in Southampton.

But Shami produced a superb display of death bowling to break Afghanistan hearts and secure India's fourth victory of the tournament.

In the other match played today, New Zealand edged out beat West Indies by five runs at Old Trafford in Manchester and all-but seal their place in the semi-finals.

Afghanistan had been given hope that they could pull off a huge surprise as India posted a modest 224-8 from their 50 overs on a slow pitch.

Virat Kohli top-scored for India with 67, while Kuldeep Yadav hit 52 in a laboured innings from the Indian team.

Chasing just their second World Cup win and first since beating Scotland in 2015, Afghanistan built a steady platform towards victory and were in line to complete the triumph until Shami struck.

Virat Kohli top-scored as India posted just 224-8 from their 50 overs ©Getty Images
Virat Kohli top-scored as India posted just 224-8 from their 50 overs ©Getty Images

The Indian fast bowler had Mohammad Nabi caught for 52 and then snared Aftab Alam and Mujeeb Ur Rahman with searing deliveries to bowl Afghanistan out for 213.

"This game was important for us," said Kohli.

"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."

New Zealand set a tough target of 292 for victory in their clash with West Indies.

Kane Williamson was again the star of the show as he hit 148 to score his second century of the tournament.

In reply, Chris Gayle hit 87 - including six sixes - and Carlos Brathwaite smashed a stunning 82-ball 101 to give their side a great chance to chase down the total.

But they fell five runs short as Brathwaite was caught in the deep by Trent Boult after trying a shot which would have won them the match.