The analysis of the x-ray spectrum is important for quality assurance (QA) and quality control (QC) of a radiographic system such as mammography. In the case of mammography, the direct measurement of the primary x-ray spectra under clinical conditions is very difficult and time-consuming mainly because it is almost impossible to increase the longitudinal distance between the focal spot and x-ray detector in order to make the photon counting measurement possible. An alternative way of measuring the primary spectra is to correct the 90 degree scattered x-ray spectra which can be measured without photon pile-up since the intensity of the scattered x-rays is significantly lowered. The scattered x-ray spectrum is composed of two components, Compton scattered photons and Rayleigh scattered photons. We have developed a new method of reconstructing the primary x-ray spectrum from the scattered x-ray spectrum taking into account both Rayleigh and Compton scattered photons . The 90 degree scattered x-ray spectrum from a 28 kV mammography x-ray unit was measured at a tube voltage by using a CdTe semiconductor detector. The reconstructed spectrum agreed fairly well with a directly measured primary x-ray spectrum. The Rayleigh and Compton scattering correction method could be suitable for measuring the mammography x-ray spectra under clinical conditions and useful for QA and QC of the mammography x-ray units.