Aims. The largest Local Group spiral galaxy, M 31, has been completely imaged for the first time, obtaining a luminosity lower limit ∼10 35 erg s −1 in the 0.2-4.5 keV band. Our XMM-Newton EPIC survey combines archival observations along the major axis, from The main goal of the paper is to study the X-ray source population of M 31.Methods. An X-ray catalogue of 1897 sources was created, with 914 detected for the first time. Source classification and identification were based on X-ray hardness ratios, spatial extent of the sources, and cross correlation with catalogues in the X-ray, optical, infrared, and radio wavelengths. We also analysed the long-term variability of the X-ray sources and this variability allows us to distinguish between X-ray binaries and active galactic nuclei (AGN). Furthermore, supernova remnant classifications of previous studies that did not use long-term variability as a classification criterion could be validated. Including previous Chandra and ROSAT observations in the long-term variability study allowed us to detect additional transient or at least highly variable sources, which are good candidate X-ray binaries. Results. Fourteen of the 30 supersoft source (SSS) candidates represent supersoft emission of optical novae. Many of the 25 supernova remnants (SNRs) and 31 SNR candidates lie within the 10 kpc dust ring and other star-forming regions in M 31. This connection between SNRs and star-forming regions implies that most of the remnants originate in type II supernovae. The brightest sources in X-rays in M 31 belong to the class of X-ray binaries (XRBs). Ten low-mass XRBs (LMXBs) and 26 LMXB candidates were identified based on their temporal variability. In addition, 36 LMXBs and 17 LMXB candidates were identified owing to correlations with globular clusters and globular cluster candidates. From optical and X-ray colour-colour diagrams, possible high-mass XRB (HMXB) candidates were selected. Two of these candidates have an X-ray spectrum as is expected for an HMXB containing a neutron star primary. Conclusions. While our survey has greatly improved our understanding of the X-ray source populations in M 31, at this point 65% of the sources can still only be classified as "hard" sources; i.e. it is not possible to decide whether these sources are X-ray binaries or Crab-like supernova remnants in M 31 or X-ray sources in the background. Deeper observations in X-ray and at other wavelengths would help classify these sources.