Developing lithium-oxygen batteries with high reversibility and long cyclability requires an electrocatalyst with superior catalytic activity and excellent stability to achieve an efficient cathode. Herein, a three-dimensional hierarchically porous carbon framework embedded with cobalt-iron-phosphide nanodots nanocomposite is fabricated via a lyophilization-pyrolysis-phosphorization process. The synthetic catalyst displays excellent performances towards both the oxygen reduction reaction and the oxygen evolution reaction. With our optimal sample, the half-wave potential for the oxygen reduction reaction is up to 0.83 V versus reversible hydrogen electrode, and its potential for the oxygen evolution reaction at a current density of 10 mA cm−2 is as low as 1.53 V in 0.1 M KOH solution. The catalyst also exhibits improved electrochemical performances in a rechargeable lithium-oxygen battery, including a high specific capacity (11969 mAh g−1 at 100 mA g−1) and a long cycle life (141 cycles at a cut-off capacity of 1000 mAh g−1). All of these results make our catalyst a promising candidate for the development of highly efficient electrocatalysts for the rechargeable lithium-oxygen batteries.