The modulation of electronic structure plays a crucial role in enhancing the adsorption of H* for photocatalytic hydrogen evolution. In this study, we prepared a three-dimensionally ordered macroporous structure of cobalt doping SrTiO3 (Co/3DOMSTO) to provide a large specific surface area that exposes more active sites. The prepared catalysts exhibited the highest rate of photocatalytic hydrogen evolution, reaching 5892.86 μmol g−1 h−1, along with an apparent quantum efficiency (AQE) of approximately 2.4% under illumination at 427 nm. Additionally, the introduction of metal cobalt helped to modulate the electronic structure of Co/3DOMSTO and facilitate spatial charge separation. X-ray absorption fine structure (XAFS) and density functional theory (DFT) calculations were conducted to demonstrate that cobalt occupied the Ti sites on the surface of 3DOMSTO, resulting in changes in the electronic distribution state within space. This phenomenon facilitates the enrichment of electrons at the adjacent Ti sites, making the charge-rich Ti a new active site. These findings underscore the pivotal role played by the geometric configuration and tailored electronic structure of 3DOMSTO in augmenting its photocatalytic performance.