Mg alloyed ZnO thin films up to 30% Mg was grown on glass substrate by spray pyrolysis method. Phase separation has been significant in 30% Mg and barely observable 20% Mg incorporated thin films. PL measurements have displayed two emissions in ZnO thin films at energy of 3.26 eV and 2.10 eV which shifts to higher energy by the Mg incorporation. Similarly, bandgap widening in MgZnO thin films has been observed up to 3.71 eV in 15% Mg incorporated thin film. The widening of the band gap has not been followed for the thin films showing phase separation. Valance band maximum (VBM) positions relative to the Fermi level has been measured by UPS and no significant variation according to the vacuum level has been observed. On the other hand, Fermi level gets close to the VBM as the Mg content increases in the thin films.