A realistic X‐ray energy spectrum is essential for accurate dose calculation using the Monte Carlo (MC) algorithm. An energy spectrum for dose calculation in the radiation treatment planning system is modeled using the MC algorithm and adjusted to obtain acceptable agreement with the measured percent depth dose (PDD) and off‐axis ratio. The simulated energy spectrum may not consistently reproduce a realistic energy spectrum. Therefore, direct measurement of the X‐ray energy spectrum from a linac is necessary to obtain a realistic spectrum. Previous studies have measured low photon fluence directly, but the measurement was performed with a nonclinical linac with a thick target and a long target‐to‐detector distance. In this study, an X‐ray energy spectrum from a clinical linac was directly measured using a NaI(Tl) scintillator at an ultralow dose rate achieved by adjusting the gun grid voltage. The measured energy spectrum was unfolded by the Gold algorithm and compared with a simulated spectrum using statistical tests. Furthermore, the PDD was calculated using an unfolded energy spectrum and a simulated energy spectrum was compared with the measured PDD to evaluate the validity of the unfolded energy spectrum. Consequently, there was no significant difference between the unfolded and simulated energy spectra by nonparametric, Wilcoxon's rank‐sum, chi‐square, and two‐sample Kolmogorov–Smirnov tests with a significance level of 0.05. However, the PDD calculated from the unfolded energy spectrum better agreed with the measured compared to the calculated PDD results from the simulated energy spectrum. The adjustment of the incident electron parameters using MC simulation is sensitive and takes time. Therefore, it is desirable to obtain the energy spectrum by direct measurement. Thus, a method to obtain the realistic energy spectrum by direct measurement was proposed in this study.