Nitrogen-doped porous interconnected double-shelled hollow carbon spheres (N-DHCSs) have been synthesized by chemical treatment of Fe3O4@C precursors using HNO3 at low temperature. When the precursors are disposed with HCl or H2SO4, uniform porous interconnected double-shelled hollow carbon spheres (DHCSs) are prepared. Comparing with DHCSs, the as-prepared N-DHCSs show higher Li-storage capacity and both show good cycling stability as anode materials in lithium ion batteries. The N-DHCSs offer a capacity of 512mAhg−1 at 1.5C after 500 cycles and their porous interconnected double-shelled hollow structure could be well kept. The N-DHCSs also show high reversible capacity of 598mAhg−1 at 1C after cycled at different current densities. In addition, the N-DHCSs as anode materials in sodium half-cell exhibit high reversible capacity of 120mAhg−1 at a current rate of 0.2Ag−1 after 100 cycles.