Batting first, West Indies scored 311 for six with fifties from Shai Hope (77), Evin Lewis (58) and Nicholas Pooran (50).
In reply, Rahmat Shah (62 off 78 balls) and Ikram Alikhil (86 off 93 balls) shared 133 runs to put Afghanistan in good position before they were stopped at 288 with the last eight wickets going for 99 runs.
Kemar Roach (3/37) and Carlos Brathwaite (4/63 in 9 overs) provided the breakthroughs at crucial moments to avoid an upset, which looked imminent at one point of time.
Afghanistan were cruising at 189 for two but Alikhil's prized scalp was taken by veteran Chris Gayle and they went out of steam.
Earlier, Pooran (58 off 43 balls) and Holder (45 off 34 balls) added 105 runs in 71 balls to take the total past 300-run mark.