The rational synthesis of high performance electrocatalysts at low cost for water splitting (hydrogen and oxygen evolution reaction, HER and OER) is highly desirable but remains a key challenge. Herein, we report a versatile molecular-confining route to construct strongly coupled metal oxides-N-C frameworks with interconnected configuration. By simply chelating various transition metal ions with ethylenediaminetetraacetic acid disodium salt (EDTA) in agarose hydrogel and subsequent carbonization, the high specific surface area porous N-C frameworks with strongly coupled metal oxides (e.g., manganese, iron, cobalt, nickel and their mixed oxides) can be prepared as advanced nonprecious water splitting electrocatalysts. For instance, the resulting Co3O4-N-C frameworks with the high surface area of 153 m2 g−1, and the moderate nitrogen content of 1.23%, require an overpotential of 324 mV to afford a current density of 10 mA cm−2 in 0.1 M KOH for OER, superior to commercial RuO2 catalysts. Density functional theory (DFT) calculations reveal that the strong coupling between N-C and Co3O4 tunes the local electronic structure of Co for high-valence active sites and assures optimal adsorption energies of OER intermediates. Moreover, Co2P-N-C electrocatalysts derived from Co3O4-N-C also exhibit excellent HER performance under 1.0 M KOH with a low overpotential of 139 mV to reach 10 mA cm−2, a small Tafel slope of 45 mV dec−1 and impressive stability, underscoring the versatility of our synthetic strategy.