Nitrogen-doped three-dimensional (3D) porous carbon materials have numerous applications due to their highly porous structures, abundant structural nitrogen heteroatom decoration and low densities. Herein, nitrogen doped hierarchical 3D porous carbons (NHPC) were prepared via a novel metal–organic aerogel (MOA), using hexamethylenetetramine (HMT), 1,3,5-benzenetricarboxylic acid and copper (II) as starting materials. The morphology, porous structure of the building blocks in the NHPC can be tuned readily using different amount of HMT, which makes elongation of the pristine octahedron of HKUST-1 to give rise to different aspect ratio rod-like structures. The as-prepared NHPC with rod-like carbons exhibit high performance in lithium sulfur battery due to the rational ion transfer pathways, high N-doped doping and hierarchical porous structures. As a result, the initial specific capacity of 1341 mA h/g at rate of 0.5 C (1 C = 1675 mA h/g) and high-rate capability of 354 mA h/g at 5 C was achieved. The decay over 500 cycles is 0.08% per cycle at 1 C, highlighting the long-cycle Li–S batteries.