The development of an efficient electrocatalyst is an important requirement for water splitting systems to produce clean and sustainable hydrogen fuel. Herein, we synthesized CoP2/Fe-CoP2 yolk-shell nanoboxes (YSBs) as efficient electrocatalysts for the oxygen evolution reaction (OER). Initially, zeolitic imidazolate framework-67/CoFe-Prussian blue analogue (ZIF-67/CoFe-PBA) YSBs were prepared by the reaction of ZIF-67 and [Fe(CN)6]3- ions in the presence of a small amount of water as an etching agent. The size of the CoP2 yolk depends on the amount of water. The heteronanostructure composed of the CoP2 yolk and the FexCo1-xP2 shell with a cubic shape was obtained by phosphidation of ZIF-67/CoFe-PBA YSBs. Benefiting from the unique structure and chemical composition, the CoP2/Fe-CoP2 YSB electrocatalyst has a large specific surface area of 114 m2 g-1 and shows superior electrocatalytic performances for the OER such as a low overpotential of 266 mV, a small Tafel slope value of 68.1 mV dec-1, and excellent cyclic stability.