We present hierarchical architecture MWCNT (multi-walled carbon nanotubes)@meso C core–shell nanostructures as a carbon matrix for effective trapping of sulfur/polysulfides as a cathode material for Li–S batteries. The unique structure of MWCNT@meso C core–shell nanocomposites was achieved by using a sol–gel coating method followed by nanocasting. By infiltrating sulfur into the matrix, S/MWCNT@meso C core–shell nanocomposites were achieved. This material exhibited an initial discharge capacity of 1248 mA h g−1 although it decayed to about 640 mA h g−1 after 50 cycles. However, this performance is much better than that of S directly deposited on MWCNT (S/MWCNT) which only retained a capacity of 120 mA h g−1 after 50 cycles. Our composite exhibited excellent rate capability even at a discharge current density of 2 A g−1. The improvement in electrochemical performance is attributed to the synergetic effect between MWCNT cores, which provide electronic conduction pathways, and the mesoporous carbon shells with a relatively high surface area, which can trap sulfur/polysulfides and provide Li+ ion pathways.