Molybdenum carbide (Mo2C) with a Pt-like d-band electron structure exhibits certain activities for oxygen reduction and evolution reactions (ORR/OER) in alkaline solutions, but it is questioned due to its poor OER stability. Combining Mo2C with transition metals alloy is a feasible way to stabilize its electrochemical activity. Herein, CoFe-Prussian blue analogues are used as a precursor to compound with graphitic carbon nitride and Mo6+ to synthesize FeCo alloy and Mo2C co-encapsulated N-doped carbon (NG-CoFe/Mo2C). The morphology of NG-CoFe/Mo2C (800 °C) shows that CoFe/Mo2C heterojunctions are well wrapped by N-doped graphitic carbon. Carbon coating not only inhibits growth and agglomeration of Mo2C/CoFe, but also enhances corrosion resistance of NG-CoFe/Mo2C. NG-CoFe/Mo2C (800 °C) exhibits an excellent half-wave potential (E1/2 = 0.880 V) for ORR. It also obtains a lower OER overpotential (325 mV) than RuO2 due to the formation of active species (CoOOH/β-FeOOH, as indicated by in-situ X-ray diffraction tests). E1/2 shifts only 6 mV after 5000 ORR cycles, while overpotential for OER increases only 19 mV after 1000 cycles. ORR/OER performances of NG-CoFe/Mo2C (800 °C) are close to or better than those of many recently reported catalysts. It provides an interfacial engineering strategy to enhance the intrinsic activity and stability of carbides modified by transition-metals alloy for oxygen electrocatalysis.