Ahmed, playing only his ninth T20 for England, finished 19 not out off seven balls. His six off the second ball of the 18th over sparked a 44-run partnership with Will Jacks, sealing the win with three balls remaining.
The 19-year-old leg-spinner replaced Jamie Overton due to a slow pitch. Captain Harry Brook indicated Ahmed's place in the semi-final in Mumbai will depend on conditions.