The conversion of CO2 into valuable chemicals has captured extensive attention for its significance in energy storage and greenhouse gas alleviation, but the development of cost-effective electrocatalysts with high activity and selectivity remains the bottleneck. Herein, we designed a Fe–N–C nanofiber catalyst featuring a core–shell structure consisting of iron nitride nanoparticles encapsulated within Fe and N codoped carbon layers that can efficiently catalyze CO2 to CO with nearly 100% selectivity, high faradic efficiency (∼95%), and remarkable durability at −0.53 V versus reversible hydrogen electrode. Theoretical calculations reveal that the introduction of an iron nitride core can facilitate the CO intermediate desorption from the Fe and N codoped shell, thus enhancing the catalytic performance of CO2 reduction. This work presents an ideal approach to rationally design and develop transition-metal and N codoped carbon materials for efficient CO2 reduction.