Metal octaethylporphyrins (M-OEP), M-N4C20H4(C2H5)8, adsorbed at a metallic substrate are promising candidates to provide spin dependent electric transport. Despite these systems having been studied extensively by experiment, details of the adsorbate geometry and surface binding are still unclear. We have carried out density functional theory calculations for cobalt octaethyl porphyrin (Co-OEP) adsorbate at clean and oxygen-covered Ni(100) surfaces as well as for the free Co-OEP molecule where equilibrium structures were obtained by corresponding energy optimizations. These geometries were then used in calculations of Co-OEP carbon and nitrogen 1s core excitations yielding theoretical excitation spectra to be compared with corresponding K-edge x-ray absorption fine structure (NEXAFS) measurements. The experimental NEXAFS spectra near the carbon K-edge of Co-OEP bulk material show large intensity close to the ionization threshold and a triple-peak structure at lower energies, which can be reproduced by the calculations on free Co-OEP. The experimental nitrogen K-edge spectra of adsorbed Co-OEP layers exhibit always a double-peak structure below ionization threshold, independent of the layer thickness. The peaks are shifted slightly and their separation varies with adsorbate-substrate distance. This can be explained by hybridization of N 2p with corresponding 3d contributions of the Ni substrate in the excited final state orbitals as a result of adsorbate-substrate binding via N–Ni bond formation.