A high-efficiency trifunctional electrocatalyst is required for practical applications of regenerative fuel cells, because the hydrogen evolution reaction (HER), oxygen reduction reaction (ORR), and oxygen evolution reaction (OER) are their core electrode reactions. However, implementation of both hydrogen and oxygen electrodes is hindered by low activity and poor stability of electrocatalysts for both water splitting and oxygen reduction. Herein, we report a high-temperature annealing strategy to fabricate a highly dispersed ruthenium-based catalyst embedded onto nitrogen-doped graphene (0.4-Ru@NG-750). The 0.4-Ru@NG-750 catalyst exhibits high trifunctional electrocatalytic activity and good stability in HER, ORR, and OER. The 0.4-Ru@NG-750 electrocatalyst exhibits a low overpotential of only 0.04 and 0.09 V at the current density of 10 mA.cm(-2) for HER in 1.0 M KOH and 0.5 M H2SO4, respectively, and 0.372 V for OER in 1.0 M KOH. Moreover, it shows a high half-wave potential of 0.826 and 0.723 V for ORR in 0.1 M KOH and 0.1 M HClO4, respectively. Structural characterizations show that RuN4Cx is one of the main structures in 0.4-Ru@NG-750. Density functional theory calculations indicate that the surface states of RuN4Cx sites evolve in different reaction conditions. In HER, ORR, and OER, the most stable states should be RuN4Cx, RuN4(OH)C-x, and RuN4(O)C-x, respectively, on which the theoretical overpotential is the lowest.