The treatment of GaAs (001) surface with different thicknesses of Mg layers has been studied. When Mg is deposited onto GaAs, the Mg immediately penetrates the top layers of the GaAs where interaction occurs between Mg and GaAs to form an impurity paired with a Mg interstitial. This change in the bonding state of Ga and As in the diffusion layers removes Ga or As intensity from the bulk peaks and moves it into the Ga or As shifted peaks. This in turn accounts for the very low effective mean free path. Further deposition of Mg forms a layer on the surface whose thickness increases with continued deposition. Deposition of Mg resulted in slight shifts for the Ga and As core levels. The chemical shift between the bulk core level and the new bond is 1 eV towards lower binding energy for the Ga case and 0.41 eV for the As case. A value of 0.43 nm has also been obtained for the inelastic scattering mean free path for electrons with kinetic energy 65 eV in the Mg layers. After 15 min annealing at 500 8C, all core levels from the substrate slightly shift back upward to the binding energy. Meanwhile, the new chemically shifted component in the Ga core level was fully desorbed but the Mg core level was still observed.