The production of ammonia from electrochemical nitrate reduction reaction (NO3RR) has emerged as a highly promising approach to replace the conventional “Haber-Bosch” process, but the research progress of this field is still hindered by the absence of a structure–activity relationship for manipulating catalyst structure to promote its catalytic performance. In this study, we chose TMSn (M=Fe, Co, Ni) alloys as the models to evaluate the electronic structure and their NO3RR activity. Alloying various transition metals with Sn allows to regulate charge distribution, thereby modulating the d-band center of the catalysts and further regulating the catalytic activity of NO3RR. Density functional theory (DFT) simulation predicts that CoSn alloy, with the strongest NO3− adsorption and lowest thermodynamic energy barrier, is potentially considered as a highly efficient NO3RR catalyst. With this theoretical guidance, a series of TMSn alloy catalysts with carbon nanofiber (TMSn-CNF) as a support were synthesized via a two-step electrospinning/carbonization strategy. The CNF as a substrate ensures the excellent cycling performance. As a result, a significantly enhanced NO3RR activity with a NH3 yield rate of 42.20 mg h−1 cm−2 at −0.6 V vs. RHE is achieved on CoSn-CNF compared with NiSn-CNF (13.91 mg h−1 cm−2), FeSn-CNF (13.81 mg h−1 cm−2) and Sn-CNF (6.10 mg h−1 cm−2), superior to most of the previously reported catalysts. We have further constructed an aqueous Zn-NO3− battery using CoSn-CNF as the cathode, achieving a remarkable power density of 5.88 mW cm−2. This battery not only generates large quantity of NH3, but also functions as an effective power source.