An X-ray spectrum is constituted by a set of peaks superimposed to a background (continuum). If a quantitative estimate of the peak areas is required, then the background must be separated from the spectrum. Several algorithms have been proposed in the literature. These algorithms will generally work well when the amplitudes of the peaks are much more intense than the background. We propose a novel method, based on projections onto convex sets. The algorithm have been tested over a large set of spectra, real and simulated. Some of the results obtained in these tests are reported here and are compared to a widely used continuum estimation method, i.e. the orthogonal polynomial decomposition.