Molybdenum disulfide/nitrogen-doped carbon nanocomposite can afford high capacity, good rate capability and cycling stability in lithium ion batteries owing to the synergistic effect from these two components. Structure of the material has a great impact on the performance as well. In this work, MoS2/nitrogen-doped carbon (MoS2/C) composites have been developed by manipulating the nano-featured polypyrrole templates to guide and confine their growth. They are formed via a simple hydrothermal process combined with a subsequent annealing process. The MoS2/nitrogen-doped carbon nanotubes (MoS2/CNT) composite with 76% of MoS2 exhibits an excellent performance including a high capacity of 1232 mAh g−1 at a current density of 0.1 A g−1, outstanding rate capability (947 mAh g−1 at 2 A g−1), and good cycling stability with 754 mAh g−1 retained over 1000 charge/discharge cycles at a high current density of 1 A g−1. This performance is much better than that MoS2/nitrogen-doped carbon nanoparticles (MoS2/CNP) composite. This work demonstrates the importance of introducing three-dimensional nanostructures in electrode materials to improve their electrochemical performance.