Oxidation is the loss of electrons during a reaction by a molecule, atom or ion. Oxidation occurs when the oxidation state of a molecule, atom or ion is increased.
The terms oxidation and reduction can be defined in terms of the adding or removing oxygen to a compound. while this is not the most robust definition, as discussed below, it is the easiest to remember.
When iron reacts with oxygen it forms a chemical called rust because it has been oxidized (The iron has lost some electrons.) and the oxygen has been reduced Oxidation is the opposite of reduction. A reduction-reaction always comes together with an oxidation-reaction. Oxidation and reduction together are called redox (reduction and oxidation).
Oxygen does not have to be present in a reaction, for it to be a redox-reaction.
The reaction between magnesium metal and oxygen to form magnesium oxide involves the oxidation of magnesium.