The MgxZn1−xO thin films with thickness about several μm were fabricated for different Mg doping concentrations on p-type Si substrates by using an ultrasonic spray pyrolysis method. The morphologies, crystal structures and optical properties were investigated by scanning electron microscopy (SEM), X-ray diffraction (XRD) and photoluminescence (PL), respectively. The SEM results indicated that the surface of MgxZn1−xO films with low Mg concentrations was flat and compact, and the roughness of films increased with Mg concentration. The XRD patterns demonstrated that the low Mg concentration MgxZn1−xO (x < 0.21) film had a wurtzite structure and the MgO phase was absent. The PL spectra revealed that UV emission has an obvious blue shift with the increase of Mg composition.