The electronic structures of supercells of CeO 2−δ have been calculated within the Density Functional Theory (DFT). The equilibrium properties such as lattice constants, bulk moduli and magnetic moments are well reproduced by the generalized gradient approximation (GGA). Electronic excitations are simulated by robust total energy calculations for constrained states with atomic core holes or valence holes. Pristine ceria CeO2 is found to be a non-magnetic insulator with magnetism setting in as soon as oxygens are removed from the structure. In the ground state of defective ceria, the Ce-f majority band resides near the Fermi level, but appears at about 2 eV below the Fermi level in photoemission spectroscopy experiments due to final state effects. We also tested our computational method by calculating threshold energies in Ce-M5 and O-K x-ray absorption spectroscopy and comparing theoretical predictions with the corresponding measurements. Our result that f electrons reside near the Fermi level in the ground state of oxygen deficient ceria is crucial for understanding the catalytic properties of CeO2 and related materials. PACS numbers: 71.28.+d, 71.15.Mb 71.15.Qe 79.60.-i