Porous nitrogen-doped carbon nanotubes (PNCNTs) with a high specific surface area (1765 m2 g−1) and a large pore volume (1.28 cm3 g−1) have been synthesized from a tubular polypyrrole (T-PPY). The inner diameter and wall thickness of the PNCNTs are about 55 nm and 22 nm, respectively. This material shows extremely promising properties for both supercapacitors and for encapsulating sulfur as a superior cathode material for high-performance lithium–sulfur (Li-S) batteries. At a current density of 0.5 A g−1, PNCNT presents a high specific capacitance of 210 F g−1, as well as excellent cycling stability at a current density of 2 A g−1. When the S/PNCNT composite was tested as the cathode material for Li-S batteries, the initial discharge capacity was 1341 mAh g−1 at a current rate of 1 C and, even after 50 cycles at the same rate, the high reversible capacity was retained at 933 mAh g−1. The promising electrochemical energy-storage performance of the PNCNTs can be attributed to their excellent conductivity, large surface area, nitrogen doping, and unique pore-size distribution.