The present nitrogen fixation industry is usually energy-intensive and environmentally detrimental. Therefore, it is appealing to find alternatives. Here, we achieved both a synchronized biological nitrogen fixation and electric energy production by using Geobacter sulfurreducens in a microbial electrochemical system. The results showed that G. sulfurreducens was able to fix nitrogen depending on anode respiration, producing a maximum current density of 0.17 ± 0.015 mA cm−2 and a nitrogen-fixing activity of ca. 0.78 μmol C2H4 mg protein−1 h−1, thereby achieving a net total nitrogen-fixing rate of ca. 5.6 mg L−1 day−1. Specifically, nitrogen fixation did not impair coulombic efficiency. Transcriptomic and metabolic analyses demonstrated that anode respiration provided sufficient energy to drive nitrogen fixation, and in turn nitrogen fixation promoted anode respiration of the cell by increasing acetate catabolism but reducing acetate anabolism. Furthermore, we showed that G. sulfurreducens could be supplied in a bioelectrochemical system for N-deficient wastewater treatment to relieve N-deficiency stress contributing to the formation of an electroactive biofilm, thereby simultaneously achieving nitrogen fixation, current generation and dissoluble organic carbon removal. Our study revealed a synergistic effect between biological nitrogen fixation and current generation by G. sulfurreducens, providing a green nitrogen fixation alternative through shifting the nitrogen fixation field from energy consumption to energy production and having implications for N-deficient wastewater treatment.