The oxidation reaction of iron and oxygen to form the substance that is commonly called rust occurs according to this equation: 4Fe + 3O2 = 2Fe2O3. Water is also required for this reaction to occur, but because the total amount of water does not change, it is not included in the equation.
The production of rust is an example of one of the most common chemical reactions on Earth: oxidation/reduction. In this type of reaction, some electrons are transferred from one substance to another. In this case, electrons are being transferred from the iron to the oxygen.
When iron loses three of its electrons to oxygen, it becomes the Fe3+ ion and oxygen becomes the O2- ion. The O2- quickly reacts with H+ ions in water to form H20. The Fe3+ ions also react with water to form iron oxide (Fe2O3), or rust.
Though the net amount of water remains the same in this reaction, the availability of water does limit the oxidation of iron, which is why iron rusts more quickly in a wet environment than a dry one.