Well magnesium nitrate is composed of Mg 2+ ions and NO3 - ions
Immediately you can see that Mg is in the +2 oxidation state. The overall charge of the anion is 1-, and O can be assumed to be 2-, which leaves N to be in the +5 oxidation state.
Now looking at the other side of the equation, you have NO2. Assuming O to be 2- means that N must be in the +4 oxidation state.
You can see now that N has gone from +5 to +4, by gaining an electron, so it has been reduced. Consequently, something else must have been oxidised.
The O on the left had side is 2-, but on the right hand side you have O2, which is a pure element so by definition its oxidation state is 0. Hence you have gone from 2- to 0, i.e. two electrons have been lost, which is oxidation.