We report in the present study the in situ formation of magnetic nanoparticles (Fe3O4 or Fe) within porous N-doped carbon (Fe3O4/N@C) via simple impregnation, polymerization, and calcination sequentially. The synthesized nanocomposite structural properties were investigated using different techniques showing its good construction. The formed nanocomposite showed a saturation magnetization (Ms) of 23.0 emu g−1 due to the implanted magnetic nanoparticles and high surface area from the porous N-doped carbon. The nanocomposite was formed as graphite-type layers. The well-synthesized nanocomposite showed a high adsorption affinity toward Pb2+ toxic ions. The nanosorbent showed a maximum adsorption capacity of 250.0 mg/g toward the Pb2+ metallic ions at pH of 5.5, initial Pb2+ concentration of 180.0 mg/L, and room temperature. Due to its superparamagnetic characteristics, an external magnet was used for the fast separation of the nanocomposite. This enabled the study of the nanocomposite reusability toward Pb2+ ions, showing good chemical stability even after six cycles. Subsequently, Fe3O4/N@C nanocomposite was shown to have excellent efficiency for the removal of toxic Pb2+ ions from water.