Unambiguous values of the spin and magnetic moment of Mg-31 are obtained by combining the results of a hyperfine-structure measurement and a beta-NMR measurement, both performed with an optically polarized ion beam. With a measured nuclear g factor and spin I=1/2, the magnetic moment mu(Mg-31)=-0.88355(15)mu(N) is deduced. A revised level scheme of Mg-31 (Z=12, N=19) with ground state spin/parity I-pi=1/2(+) is presented, revealing the coexistence of 1p-1h and 2p-2h intruder states below 500 keV. Advanced shell-model calculations and the Nilsson model suggest that the I-pi=1/2(+) ground state is a strongly prolate deformed intruder state. This result plays a key role for the understanding of nuclear structure changes due to the disappearance of the N=20 shell gap in neutron-rich nuclei.