The construction of p-n heterojunctions has become a widely adopted strategy for achieving the selective detection of reducing gases, including H 2 and CO. Nevertheless, the elucidation of the gas selectivity mechanism at the nanoscale remains elusive. First-principle calculations provide an attractive avenue for comprehending the influence of coordination structures on gas-sensitive selectivity, thereby unveiling the structure−activity relationship of p-n heterojunction sites. In this study, we investigate the selective adsorption behavior of H 2 and CO on a NiO-TiO 2 heterojunction using density functional theory. The results of d-band center analysis confirm that the NiO-TiO 2 heterojunction with adsorbed oxygen significantly enhances the adsorption stability of reducing gases. Intriguingly, our calculations reveal that H 2 has a higher affinity for adsorbed oxygen on the heterojunction surface compared to that of CO, corresponding to a lower H 2 adsorption energy. Density of states (DOS) results indicate that the NiO-TiO 2 heterojunction, with preadsorbed oxygen, exhibits ultrahigh selectivity with an n-type gas-sensitive response to H 2 , effectively eliminating the cross-sensitivity observed with CO, as confirmed by gas-sensitive characterization research. The sensing mechanism of the NiO-TiO 2 heterojunction's selective detection of H 2 without interference from CO can be visually explained by electron transfer and potential barrier changes, paving the way for future developments in novel, selective gas-sensitive materials.