A rocket in space does not need air to push against. Its engine produces thrust by expelling exhaust mass at high velocity in one direction, driving the vehicle in the opposite direction. This behavior follows conservation of momentum, a core principle of classical mechanics that holds even in a perfect vacuum.
In a rocket engine, chemical energy in the propellant becomes thermal energy, raising pressure in the combustion chamber. Hot gas then accelerates through the nozzle and exits as a fast exhaust stream. The change in momentum of that exhaust creates an equal and opposite momentum change for the rocket. This is formalized in the rocket equation, which links thrust to exhaust velocity and mass flow rate, not to surrounding air.
Air can affect engine cooling and structural loads during launch, but it is not part of the thrust mechanism. Whether surrounded by dense atmosphere or near-empty space, a rocket accelerates by throwing mass backward. Vacuum removes drag and atmospheric back pressure, allowing the exhaust to expand more fully and the engine to operate closer to its ideal performance.