We present the first detection of X-ray coherent pulsations from the transitional millisecond pulsar XSS J12270–4859 , while it was in a sub-luminous accretion disk state characterized by a 0.5–10 keV luminosity of 5 \times 10 ^ { 33 } erg s ^ { -1 } ( assuming a distance of 1.4 kpc ) . Pulsations were observed by XMM-Newton at an rms amplitude of ( 7.7 \pm 0.5 ) \% with a second harmonic stronger than the the fundamental frequency , and were detected when the source is neither flaring nor dipping . The most likely interpretation of this detection is that matter from the accretion disk was channelled by the neutron star magnetosphere and accreted onto its polar caps . According to standard disk accretion theory , for pulsations to be observed the mass in-flow rate in the disk was likely larger than the amount of plasma actually reaching the neutron star surface ; an outflow launched by the fast rotating magnetosphere then probably took place , in agreement with the observed broad-band spectral energy distribution . We also report about the non-detection of X-ray pulsations during a recent observation performed while the source behaved as a rotationally-powered radio pulsar .