Context : The X-ray emission from Herbig Be/Ae stars has so far defied an unequivocal explanation . In later-type T Tauri stars , X-rays are thought to be produced by magnetically trapped coronal plasma , although accretion-shock induced X-rays have also been suggested . In earlier-type ( OB ) stars , shocks in unstable winds are thought to produce X-rays . Aims : We present the first high-resolution X-ray spectrum of a prototypical Herbig star ( AB Aurigae ) , measure and interpret various spectral features , and compare our results with model predictions . Methods : We use X-ray spectroscopy data from the XMM-Newton Reflection Grating Spectrometers and the EPIC instruments . The spectra are interpreted using thermal , optically thin emission models with variable element abundances and a photoelectric absorption component . We interpret line flux ratios in He-like triplet of O vii as a function of electron density and the UV radiation field . We use the nearby co-eval classical T Tauri star SU Aur as a comparison . Results : AB Aurigae reveals a soft X-ray spectrum , most plasma being concentrated at 1–6 MK . The He-like triplet reveal no signatures of increased densities as reported for some accreting T Tau stars in the previous literature . There are also no clear indications for strong abundance anomalies in the emitting plasma . The light curve displays modulated variability , with a period of \approx 42 hr . Conclusions : It is unlikely that a nearby , undetected lower-mass companion is the source of the X-rays . Accretion shocks close to the star should be irradiated by the photosphere , leading to alteration in the He-like triplet fluxes of O vii , which we do not measure . Also , no indications for high densities are found , although the mass accretion rate is presently unknown . Emission from wind shocks is unlikely , given the weak radiation pressure . A possible explanation would be a solar-like magnetic corona . Magnetically confined winds provide a very promising alternative . The X-ray period is indeed close to periods previously measured in optical lines from the wind .