A spin-dependent emission of optically oriented electrons from p-GaAs(Cs,O) into vacuum was experimentally observed in a magnetic field normal to the surface. This phenomenon is explained within the model which takes into account the jump in the electron g factor at the semiconductor-vacuum interface. Due to this jump, the effective electron affinity on the semiconductor surface depends on the mutual direction of optically oriented electron spins and the magnetic field, resulting in the spin-dependent photoemission. It is demonstrated that the observed effect can be used for the determination of spin diffusion length in semiconductors.