A synthetic route to low-density porous Ni-doped Co3O4 nanomaterials that show stable and superior electrocatalytic activity for O2 evolution reaction is reported. The materials are prepared via thermal treatment of "pre-synthesized" metal ions-embedded graphitic C3N4-based polymers.