According to NASA, a rocket engine works by burning fuel and pushing the resulting hot gas out through an exhaust nozzle on the rear of the craft. Since every action has an equal and opposite reaction, as stated by Newton's third law, the force created by the escaping gases pushes the rocket forward, even in the vacuum of space.
Rockets may use either liquid or solid fuel. There are many different types of rocket fuel, but they all have reactivity in common. When the fuel is mixed or ignited, it produces large volumes of gas, suitable for propelling the vehicle forward. Petroleum-based fuels were used in early rocketry experiments, but these fuels work best in an atmosphere. Cryogenic fuels, like liquid hydrogen and oxygen, were used in the Space Shuttle and had the advantage of being extremely efficient. However, the need to keep the fuels supercooled prevented their use in rockets that may need to stand for long periods of time.
Hypergolic fuels, like hydrazine, require no ignition source, reacting and producing thrust whenever the components of the fuel mixture come in contact with one another. The fuels used in the Apollo spacecraft were hypergolic to ensure there could be no ignition problems once the spacecraft reached the moon.