The key issue is that the aircraft doesn't know or care whether it's in a headwind or tailwind.
Airspeed (Mach), gross weight, temperature and altitude determine the thrust required and thus the fuel burned per hour. The wind simply means you're flying for a longer or short duration to cover the same ground track, thus requiring more or less total fuel.