However, Bumrah's five-run penultimate over gave Shami plenty of runs to play with and, despite being belted for a first-ball boundary, he sealed a tense victory in thrilling style, with the 10th hat-trick in World Cup history.
Rating the win over Afghanistan as a special one, the India captain said the wicket was a hard one for stroke-making because of its two-paced nature.
Shami (9.5-1-40-4), playing his first match, not only successfully defended 16 runs off the last over but also dismissed the risky Mohammed Nabi (52 off 55 balls), Aftab Alam (0) and Mujeeb ur Rahman (0) off successive deliveries to complete the rare feat.
India made one change from its 89-run win over archrival Pakistan last Sunday, bringing in bowler Mohammed Shami for the injured Bhuvneshwar Kumar.
A day after Sri Lanka stunned England in Leeds, an even bigger upset looked on the cards only for India to sneak home by 11 runs after strike bowler Shami's last-gasp heroics. Shami was really good today.
India had been limited by an Afghanistan attack blazed for 397 by England at Old Trafford four days earlier, with Mujeeb (1-26), Rashid Khan (1-38) and Nabi (2-33) suffocating Virat Kohli's men with spin - Kolhi (67) and Kedar Jadhav (52) the only players to pass fifty.
Dhoni (24 off 36 balls) and Jadhav (31 off 48) added 57 runs off 84 balls for the fifth wicket, thus slowing down the proceedings considerably in the middle overs.
India had a close win against Afghanistan on Saturday by defending a total of only 225 after failing with the batting to their usual standard of batting in the tournament so far. Shami was two on two and the next wicket would have meant a hat-trick for him.
"When chasing around 220 you need some batsmen to take responsibility and go longer".