X-ray photoelectron spectroscopy (XPS) is a widely used tool for quantitative analysis of surfaces, providing critical information about elemental composition and the chemical state(s) of each element. Quantitative analysis of XPS data requires fitting of curves corresponding to different chemical states with appropriate spectral lines. Traditionally, analysis of peak profiles is performed using peak shapes that have been determined empirically; however, these methods cannot readily account for changes in the symmetry of peak shapes due to differences in electronic structure. A physically rigorous technique is introduced herein that can fit symmetric and asymmetric peak profiles by determining the Wertheim-Walker profile based on densities of states calculated by density functional theory (DFT + WW). The DFT + WW method uniquely can accurately predict changes in XPS line shape due to changes in d-band filling, lattice contraction and expansion, and atomically precise chemical environments. A DFT + WW profile is suitable for applications where a hypothesized model structure of a material can be accurately calculated and, in these cases, the XPS fits provide a test of whether the hypothesized structure has a similar density of states to the experimental sample. This could allow improved peak assignment and improved interpretation of XP spectra. When applied to spectra from single-crystal transition-metal samples, the DFT + WW method gives excellent fits, with a similar accuracy to common peak profiles - Voigt, Doniach-Šunjić, and Mahan. Furthermore, the DFT + WW method captures experimentally observed changes in the peak shape between bulk metals and overlayer structures. Overall, the DFT + WW method provides a clear link between electronic structure and XPS line profile, allowing for possible improvements in the interpretation of XP spectra.