Magnetic field geometry is expected to play a fundamental role in magnetar activity. The discovery of a phase-variable absorption feature in the X-ray spectrum of SGR 0418+5729, interpreted as cyclotron resonant scattering, suggests the presence of very strong non-dipolar components in the magnetic fields of magnetars. We performed a deep XMM-Newton observation of pulsar 1E 2259+586 to search for spectral features due to intense local magnetic fields. In the phase-averaged X-ray spectrum, we found evidence for a broad absorption feature at very low energy (0.7 keV). If the feature is intrinsic to the source, it might be due to resonant scattering and absorption by protons close to star surface. The line energy implies a magnetic field of ∼1014 G, which is roughly similar to the spin-down measure, ∼6 × 1013 G. Examination of the X-ray phase-energy diagram shows evidence for another absorption feature, the energy of which strongly depends on the rotational phase (E ≳ 1 keV). Unlike similar features detected in other magnetar sources, notably SGR 0418+5729, it is too shallow and limited to a short phase interval to be modeled with a narrow phase-variable cyclotron absorption line. A detailed phase-resolved spectral analysis reveals significant phase-dependent variability in the continuum, especially above 2 keV. We conclude that all the variability with phase in 1E 2259+586 can be attributed to changes in the continuum properties, which appear consistent with the predictions of the resonant Compton scattering model.