The Sb encapsulated in S and N co-doped three-dimensionally (3D) interconnected macroporous carbon composite (denoted as Sb@S,N-3DPC) has been fabricated by using silica opals as hard template following a carbonization process. The structural and morphological characterizations reveal the uniform 3D-network structure with the Sb nanoparticles embedded homogeneously in the carbon spherical shell. The Sb@S,N-3DPC electrode shows a high reversible capacity of 482mAhg−1 at 100mAg−1, displaying good capacity stability (~93% of the initial discharge capacity after 500 cycles at 100mAg−1). The electrode displays superior rate capability and ultralong cyclability (255mAhg−1 at 2Ag−1after 2000 cycles) and also reveals a good rate capability that maintains 160mAhg−1 at 5Ag−1. The excellent electrochemical performance of the Sb@S,N-3DPC is attributed to the 3D-porous carbon network structure and uniform distribution of Sb nanoparticles in carbon matrix, enhancing the conductivity, holding the structure integrity, and thus improving the cycling performance of the anode material. In addition, sulfur and nitrogen co-doping introduced more defects and active sites to the carbon framework, thereby improving the interfacial adsorption and electrochemical behaviors.