A method to determine the spectrum of a clinical photon beam from measured depth-dose data is described. At shallow depths, where the range of Compton-generated electrons increases rapidly with photon energy, the depth dose provides the information to discriminate the spectral contributions. To minimize the influence of contaminating electrons, small (6 x 6 cm2) fields were used. The measured depth dose is represented as a linear combination of basis functions, namely the depth doses of monoenergetic photon beams derived by Monte Carlo simulations. The weights of the basis functions were obtained with the Cimmino feasibility algorithm, which examines in each iteration the discrepancy between predicted and measured depth dose. For 6 and 15 MV photon beams of a clinical accelerator, the depth dose obtained from the derived spectral weights was within about 1% of the measured depth dose at all depths. Because the problem is ill conditioned, solutions for the spectrum can fluctuate with energy. Physically realistic smooth spectra for these photon beams appeared when a small margin (about +/- 1%) was attributed to the measured depth dose. The maximum energy of both derived spectra agreed with the measured energy of the electrons striking the target to within 1 MeV. The use of a feasibility method on minimally relaxed constraints provides realistic spectra quickly and interactively.