Synthetic orthopyroxenes on the join enstatite-ferrosilite (Mg2Si2O6-Fe2Si2O6) have been studied by XANES spectroscopy with the aim to interpret the variation found in the spectra due to the Mg-Fe substitution in the orthopyroxene structure. The experimental Fe K-edge and Mg K-edge spectra show variation of the peak intensities as a function of the chemical composition along the enstatite-ferrosilite (En-Fs) join. At the Fe K-edge, the intensity ratio between the two most intense peaks varies linearly with the enstatite content (En mole %). Theoretical spectra have been calculated both at the Fe and Mg K-edge to interpret the experimental data. The spectra, obtained by locating Fe (or Mg) in M1 and M2 sites and weighting these contributions according to occupancy data obtained by Rietveld structure refinement, reproduce very well the experimental spectra, and allow to discriminate the contributions to the total spectrum due to Fe (Mg) located in each site.