A novel Ag@nitrogen-doped porous carbon (Ag-NPC) composite was synthesized via a facile hydrothermal method and applied as an anode material in lithium-ion batteries (LIBs). Using this method, Ag nanoparticles (Ag NPs) were embedded in NPC through thermal decomposition of AgNO3 in the pores of NPC. The reversible capacity of Ag-NPC remained at 852 mAh g−1 after 200 cycles at a current density of 0.1 A g−1, showing its remarkable cycling stability. The enhancement of the electrochemical properties such as cycling performance, reversible capacity and rate performance of Ag-NPC compared to the NPC contributed to the synergistic effects between Ag NPs and NPC.