We have performed ab initio study of different magnesium surface properties based on density functional theory methods  in general gradient approximation (GGA) level with Perdew-Burke-Ernzerhof (PBE) exchange-correlation functional . Numerical calculations have been done with CRYSTAL14 program package  exploring modified Gaussian-type DZVP basis sets for magnesium and oxygen atoms from article . Using super-cell approach we found magnesium surface energies in the range of 39 – 64 meV/ Å2 for different crystallographic planes with Miller’s indices (001), (100) and (110). The electron work functions found to be in the range 3.16-3.73 eV that is a little smaller of experimental value for (001) plane – 3.84 eV . We have obtained good agreement with experimental data for calculated inter-layer distances for first three layers new the surface. Obtained values of oxygen adsorption energies are in good agreement with previous study with VASP program package , 4.9-5.1 eV per oxygen atom. We have found that energy shifts of 2p electron in magnesium atoms new surface are in range 0.1-1.0 eV depending on oxygen density.  P. Hohenberg and W. Kohn, Phys. Rev. 136 (1964) B864;  J. P. Perdew, K. Burke, and M. Ernzerhof, Phys. Rev. Lett. 77 (1996) 3865;  R. Dovesi, R. Orlando, B. Civalleri, C. Roetti, V.R. Saunders, C.M. Zicovich-Wilson, Z. Kristallogr., 220 (2005) 571;  M.F. Peintinger, D. V. Oliveira and T. Bredow, J. Comput. Chem., 2013, 34, 451;  H.B. Michaelson, J. Appl. Phys. 48, 4729 (1977);  E.Schroder, R. Fasel, A. Kiejna, Phys. Rev. B 69,193405 (2004).