A detailed study of the near-surface structure and composition of Nb, the material of choice forsuperconducting radio-frequency accelerator (SRF) cavities, is of great importance in order to understandthe effects of different treatments applied during cavity production. By means of surface-sensitivetechniques such as grazing incidence diffuse x-ray scattering, x-ray reflectivity, and x-ray photoelectronspectroscopy, single-crystalline Nb(100) samples were investigated in and ex situ during annealing in anultrahigh vacuum as well as in nitrogen atmospheres with temperatures and pressures similar to the onesemployed in real Nb cavity treatments. Annealing of Nb specimens up to 800 °C in a vacuum promotes apartial reduction of the natural surface oxides (Nb2O5, NbO2, and NbO) into NbO. Upon cooling to 120°C,no evidence of nitrogen-rich layers was detected after nitrogen exposure times of up to 48 h. An oxygenenrichment below the Nb-oxide interface and posterior diffusion of oxygen species towards the Nb matrix,along with a partial reduction of the natural surface oxides, was observed upon a stepwise annealing up to250 °C. Nitrogen introduction to the system at 250 °C promotes neither N diffusion into the Nb matrix northe formation of new surface layers. Upon further heating to 500 °C in a nitrogen atmosphere, the growth ofa new subsurface NbxNy layer was detected. These results shed light on the composition of the near-surfaceregion of Nb after low-temperature nitrogen treatments, which are reported to lead to a performanceenhancement of SRF cavities.