Using a first-principles approach, we investigate nitrogen bonding configurations at nitrided Si(001) surfaces and Si(001)-SiO2 interfaces by comparing calculated core-level shifts with measured photoemission spectra. Fully relaxed model structures are generated in which N atoms occur in a variety of positions and bonding configurations that include, in particular, H nearest neighbors and dangling bonds. By establishing a correspondence between the bonding environment of the N atoms and their 1s core-level shifts, we provide a scheme for the interpretation of experimental photoemission spectra for both the nitrided surface and the nitrided interface. We also calculate Si 2p core-level shifts focusing on the effects of Si-N bonds, and find good agreement with experiment also in this case.