Hierarchically porous carbon foam composites with highly dispersed Fe2O3 nanoparticles confined in the foam pores, facilely fabricated by hydrolysis-driven emulsion polymerization strategy. The as-generated acidic conditions of Fe3+ hydrolysis could catalyze the polymerization of phenolic resin, and the carbon-based composite materials containing iron oxides were obtained in situ. The structural characterization results show that HCF@Fe2O3 NPs-2 electrode has the largest specific surface area (549 m2/ g) and pore volume (0.46 cm3/ g). Electrochemical results indicates that typical HCF@Fe2O3 NPs-2 electrode displays good capacitive properties. including high specific capacitance (225 F/g at 0.2 A/g current density). Excellent magnification performance (capacity retention rate 80% as current density increases from 0.2 to 10 A/g). At the same time, HCF@SnO2 NPs was successfully synthesized by replacing hydrolyzed tin tetrachloride with ferric chloride. This study provides a new idea for the preparation of metal oxide–carbon matrix composites, and also highlights the potential of such carbon foams in application of energy storage.