The effect of Mg δ-doping on the structural, electrical and optical properties of GaN grown via metalorganic vapor phase epitaxy has been studied using transmission electron microscopy, secondary ion mass spectroscopy, atomic force microscopy, x-ray diffraction, Hall effect measurements and photoluminescence. For an average Mg concentration above 2.14 × 10 19 cm −3 , phase segregation occurs, as indicated by the presence of Mg-rich pyramidal inversion domains in the layers. We show that δ-doping promotes, in comparison to Mg continuous doping, the suppression of extended defects on the samples surface and improves significantly the morphology of the epilayers. Conversely, we can not confirm the reduction in the threading dislocation density -as a result of δ-doping -reported by other authors. In the phase separation regime, the hole concentration is reduced with increasing Mg concentration, due to self-compensation mechanisms. Below the solubility limit of Mg into GaN at our growth conditions, potential fluctuations result in a red-shift of the emission energy of the free-to-bound transition.