Aims. We constrain the mass-to-radius ratio of isolated neutron stars by performing a spin-phase resolved X-ray spectroscopic analysis. Methods. We combined the data from all observations of RBS 1223 (1RXS J130848.6+212708) conducted by XMM-Newton EPIC pn with the same instrumental setup in 2003−2007 to form spin-phase resolved spectra. We implemented a number of complex models of neutron stars with strongly magnetized (Bpole ∼ 1013−1014 G) surfaces, various temperature and magnetic-field distributions around their magnetic poles, and a partially ionized hydrogen-thin atmosphere above into the X-ray spectral fitting package XSPEC for simultaneous fitting of phase-resolved spectra. A Markov-chain Monte Carlo (MCMC) approach is also applied to verify the results of fitting and estimating of parameters in multi-parameter models. Results. The spectra of different rotational phase intervals and light curves of different energy bands with high signal-to-noise ratio show a high complexity. The spectra can be parameterized with a Gaussian absorption-line superimposed on a blackbody spectrum, while the pulsed fraction of light curves with double-humped shape strongly depend upon the energy band (13−42%), which indicates that radiation emerges from at least two emitting areas. Conclusions. A model with a condensed iron surface and partially ionized hydrogen-thin atmosphere above allows us to fit simultaneously the observed general spectral shape and the broad absorption feature observed at 0.3 keV in different spin phases of RBS 1223. We constrain some physical properties of the X-ray emitting areas, i.e. the temperatures (Tp1 ∼ 105 eV, Tp2 ∼ 99 eV), magnetic field strengths (Bp1 ≈ Bp2 ∼ 8.6 × 1013 G) at the poles, and their distribution parameters (a1 ∼ 0.61, a2 ∼ 0.29, indicating an absence of strong toroidal magnetic field component). In addition, we are able to place some constraints on the geometry of the emerging X-ray emission and the gravitational redshift (z = 0.16+0.03 −0.01) of RBS 1223.