Sn-based materials are promising as high-capacity anode materials for lithium-ion batteries. A novel Sn/carbon composite is obtained facilely by using Sn-based metal-organic frameworks and dicyandiamide as precursors. The composites are composed of Sn/SnOx core-shell microspheres encapsulated in 3D porous nitrogen-doped carbon frameworks (denoted as Sn/SnOx@NC). When used as anode material for lithium-ion batteries, the Sn/SnOx@NC composite exhibites a high reversible capacity of 817.8 mA h g-1 at 100 mA g-1 after 200 cycles and 525.7 mA h g-1 at 1 A g-1 after 800 cycles. It also exhibits high capacity retention and high Coulombic efficiency. The excellent electrochemical performance can be primarily ascribed to the peculiar porous N-doped carbon frameworks, which can effectively buffer the huge volume change of Sn and promote the transmission of electrons and Li+, thereby indicating its potential for use as an anode material for Li-ion batteries.