Zeolitic imidazolate frameworks (ZIFs) are widely employed in catalyst synthesis as parental materials for electrochemical energy storage and conversion. Herein, we have demonstrated a facile synthesis of highly efficient catalyst for oxygen reduction reaction in both alkaline and acidic medium, which is derived from ZIF-8 functionalized with ammonium ferric citrate via two-step pyrolysis in Ar and NH3 atmosphere. The results reveal that the catalytic activity improvement after NH3 pyrolysis benefits from mesopore-dominated morphology and high utilization of Fe-containing active sites. The optimum catalyst shows excellent performance in zinc-air battery and polymer electrolyte membrane fuel cell tests.