A spongy CoS 2 /carbon composite assembled from CoS 2 nanoparticles (∼20 nm) homogeneously anchored on a spongy carbon matrix was synthesized through a facile freeze-drying method and a hydrothermal process. As anode material for lithium/sodium ion batteries (LIBs/SIBs), this composite shows significantly enhanced lithium/sodium storage performance with the synergetic effects due to the electrical conductivity of the carbon matrix and the porous structure, which provide buffer spaces for volume expansion during charge/discharge processes and feasible transfer pathways for electrons/ions. The electrochemical results demonstrate that the spongy CoS 2 /carbon composite is an outstanding anode material for LIBs and SIBs. It delivers a high specific capacity of 610 mAh g −1 at 500 mA g −1 after 120 cycles in LIBs and 330 mAh g −1 at 500 mA g −1 after 60 cycles in SIBs, respectively. Moreover, the freeze-drying/hydrothermal process developed in this work could be useful for the construction of many other high-capacity metal sulfide composites as electrode materials for sodium ion batteries.