X-ray spectrum plays an important role in computed tomography (CT) beam hardening correction, dual spectral X-ray CT imaging, and radiation dose calculation. The commonly used method to estimate X-ray spectrum is to estimate the spectra indirectly by using the attenuation data of X-ray passing through the phantoms with different thickness. Since the problem is seriously ill-conditioned, how to choose a suitable mold, establish scanning models and construct solving methods to improve the robustness and accuracy of energy spectrum estimation is the focus of this paper. In this work, in the absence scattering, we present a method to estimate the distribution of the X-ray spectrum by using CT scanning data. In this method, the mutual verification relationship between spectral estimation and image reconstruction is considered. That is, when the spectral estimation is correct, the spectral information can be used to construct a correction algorithm to remove hardening artifacts, and the image without hardening artifacts can be obtained. When the reconstructed image has no hardening artifact, it can indirectly prove that the estimated spectrum is accurate. For single-material molds, when there is no hardening artifact, CT images are fragmentation constant, which can be described by image total variation (TV) minimum. In this method, the mutual corroboration relationship is used to construct an optimization model, and then the X-ray spectrum is estimated and CT images without hardening artifacts are reconstructed through alternate iterative solutions. The characteristic of this method is that it does not necessitate obtaining the cross-line length of the measured mold with different thickness in advance, and it does not require high production precision of the said mold either. When there is a small amount of scattering in CT scanning data, the proposed method can also better estimate the energy spectrum, except for the large deviation in the high-energy part. However, as the scattering ratio increases, the high-energy portion of the energy spectrum will increase, resulting in the estimated spectrum differing greatly from the actual spectrum. Therefore, in the actual experiment, we add collimors in front of the X-ray source and detector to reduce the influence of scattering on the energy spectrum estimation. The numerical result and experimental result show that the proposed method can accurately and robustly estimate the X-ray energy spectrum.