We report on a growth study of MgO films deposited on Al2O3(0001) substrates by magnetron sputtering. The films exhibited a preferred rocksalt MgO(111) orientation. Surprisingly, depending on the O2 gas flow ratio, a structure of graphiticlike wurtzite MgO(0001) has been revealed. The observed Mg-O perpendicular bond length reduction is accompanied by an atomically flat surface morphology for the development of MgO(111) films; the transition to the bulk rocksalt structure occurs in the 3-6 nm coverage range. Previously, relaxation of the electrostatic instability of MgO(111) films accompanied by an in-plane lattice increase has been suggested theoretically [Phys. Rev. Lett. 98, 205701 (2007)]. Here, relying on ab initio calculations, we infer that Mg vacancies facilitate the lattice match with the substrate. This mechanism suggests methods to engineer oxide heterostructures.