We investigate the serendipitous X-ray source population revealed in XMM–Newton observations targeted in the Galactic plane within the region 315° < l < 45° and |b| < 2Graphic. Our study focuses on a sample of 2204 X-ray sources at intermediate to faint fluxes, which were detected in a total of 116 XMM–Newton fields and are listed in the Second XMM–Newton Serendipitous Source Catalog. We characterize each source as spectrally soft or hard on the basis of whether the bulk of the recorded counts have energies below or above 2 keV and find that the sample divides roughly equally (56 per cent:44 per cent) into these soft and hard categories. The X-ray spectral form underlying the soft sources may be represented as either a power-law continuum with Γ∼ 2.5 or a thermal spectrum with kT∼ 0.5 keV, with N[Subscript:H] ranging from 10[Superscript:20] to 10[Superscript:22] cm[Superscript:−2]. For the hard sources, a significantly harder continuum form is likely, that is, Γ∼ 1, with N[Subscript:H]= 10[Superscript:22]–10[Superscript:24] cm[Superscript:−2]. For ∼50 per cent of the hard sources, the inferred column density is commensurate with the total Galactic line-of-sight value; many of these sources will be located at significant distances across the Galaxy, implying a hard-band luminosity L[Subscript:X] > 10[Superscript:32] erg s[Superscript:−1], whereas some will be extragalactic interlopers. A high fraction (≳90 per cent) of the soft sources have potential near-infrared (NIR) (Two-Micron All-Sky Survey and/or United Kingdom Infrared Deep Sky Survey) counterparts inside their error circles, consistent with the dominant soft-X-ray-source population being relatively nearby coronally-active stars. These stellar counterparts are generally brighter than J= 16, a brightness cut-off which corresponds to the saturation of the X-ray coronal emission at L[Subscript:X]= 10[Superscript:−3] L[Subscript:bol]. In contrast, the success rate in finding likely IR counterparts to the hard X-ray sample is no more than ≈15 per cent down to J= 16 and ≈25 per cent down to J= 20, set against a rapidly rising chance coincidence rate. The make-up of the hard-X-ray-source population, in terms of the known classes of accreting and non-accreting systems, remains uncertain.