Rusting is an oxidation reaction. The iron reacts with water and oxygen to form hydrated iron(III) oxide, which we see as rust.
Here is the word equation for the reaction:
iron + water + oxygen → hydrated iron(III) oxide
Iron and steel rust when they come into contact with water and oxygen – both are needed for rusting to occur.
In the experiment below, the nail does not rust when air (containing oxygen) or water is not present:
Boiling the water removes the oxygen and the layer of oil prevents it from re-entering. Anhydrous calcium chloride removes water vapour from the air.
Salt dissolved in water does not cause rusting, but it does speed it up – as does acid rain.
Aluminium does not rust or corrode, because its surface is protected by a protective layer of aluminium oxide. This prevents the metal below from coming into contact with air (containing oxygen). Unlike rust, which can flake off the surface of iron and steel objects, the layer of aluminium oxide does not flake off.