We assessed the contribution to the X-ray (above 2 keV) luminosity of the Milky Way by different classes of low-mass binary systems and single stars. We began by using the RXTE Slew Survey of the sky at vertical bar b vertical bar > 10 degrees to construct an X-ray luminosity function (XLF) of nearby X-ray sources in the range 10(30) erg s(-1) < L-x < 10(34) erg s(-1) (where L-x is the luminosity over 2-10 keV), occupied by coronally active binaries (ABs) and cataclysmic variables (CVs). We then extended this XLF down to L-x similar to 10(27.5) erg s(-1) using the Rosat All-Sky Survey in soft X-rays and available information on the 0.1-10 keV spectra of typical sources. We found that the local cumulative X-ray (2-10 keV) emissivities (per unit stellar mass) of ABs and CVs are (2.0 +/- 0.8) x 10(27) and (1.1 +/- 0.3) x 10(27) erg s(-1) M-circle dot(-1), respectively. In addition to ABs and CVs representing old stellar populations, young stars locally emit (1.5 +/- 0.4) x 10(27) erg s(-1) M-circle dot(-1). Finally to the XLF of ABs and CVs we attached a high luminosity branch (up to similar to 10(39) erg s(-1)) composed of neutron-star and black-hole low-mass X-ray binaries (LMXBs), derived in previous work. The combined XLF covers similar to 12 orders of magnitude in luminosity. The estimated combined contribution of ABs and CVs to the 2-10 keV luminosity of the Milky Way is similar to 2 x 10(38) erg s(-1), or similar to 3% of the integral luminosity of LMXBs averaged over nearby galaxies. The XLF obtained in this work is used elsewhere to assess the contribution of point sources to the Galactic ridge X-ray emission.