To enhance electrochemical performance of lithium or sodium-ion batteries (LIBs or NIBs), active materials are usually filled in porous conductive particles to produce anode composites. However, it is still challenging to achieve high performance anode composites with high specific capacity, excellent rate performance, high initial Coulombic efficiency (ICE) and long cycle life. Based on these requirements, we design and fabricate activated carbon-coated carbon nanotubes (AC@CNT) with hierarchical structures containing micro-and meso-pores. A new structure of phosphorus/carbon composite (P@AC@CNT) is prepared by confining red P in porous carbon through a vaporization-condensation-conversion method. The micro-pores are filled with P, while the meso-pores remain unoccupied, and the pore openings on the particle surface are sealed by P. Due to the unique structure of P@AC@CNT, it displays a high specific capacity of 1674 mA h g −1 at 0.2 C, ultrahigh ICE of 92.2%, excellent rate performance of 1116 mA h g −1 at 6 C, and significantly enhanced cycle stability for LIBs. The application of P@AC@CNT in NIBs is further explored. This method for the fabrication of the special composites with improved electrochemical performance can be extended to other energy storage applications.