With the increased consumption of LiFePO4 batteries, the number of spent batteries has also increased sharply, and recycling LiFePO4 batteries has become an urgent task today. Herein, we propose a high-efficient strategy for separation of Fe and Li from leaching solution of spent LiFePO4 materials by cation exchange resin and a new method for preparation of high-performance anode materials. The adsorption efficiencies of Fe and Li by cation exchange resin were 99.9 % and 5.3 % under the conditions of solid–liquid ratio of 1:5, flow rate of 4 BV/h, and Fe and Li concentrations of 2.88 g/L and 0.44 g/L, respectively. High-purity Li2CO3 could be successfully produced from the effluent of resin adsorption. The Fe-saturated waste cation exchange resin was used to prepare the porous-C/FeS (P-C/FeS) composite with FeS content of 41 %, which was characterized by XRD, XPS, SEM, TEM and TGA analysis. The P-C/FeS materials exhibited remarkable electrochemical performance when using as anode materials, which could deliver a high discharge capacity of 372.8 mA g−1 after 500 cycles at 5 A/g for lithium-ion batteries, and a discharge capacity of 246.5 mAh g−1 after 500 cycles at 1.0 A/g for sodium-ion batteries. The in situ XRD analysis demonstrated the transformation reaction between Li+ and FeS. This work offers a green strategy toward the recycling of both spent lithium-ion batteries and waste cation exchange resins.