Significance Oxygen diatomic molecules have lone-pair electrons and magnetic moments. A high-pressure phase called epsilon oxygen is considered stable in a wide pressure range. This material exhibits the transition to metal at ∼100 GPa (1,000,000× atmospheric pressure). The change in the electronic structure involved in the transition under pressure is difficult to measure using conventional methods. In this study, the electronic structures of oxygen have been successfully measured with oxygen K -edge X-ray Raman scattering spectroscopy. We found a change in the spectra related to the metallization of oxygen. Another change in the electronic structure was also observed at ∼40 GPa. This is likely related to the semimetallic transition.