FeS2 nanocrystals are successfully prepared in the carbon capsules of pre-prepared hierarchical porous carbon (HPC). The absorbed Fe ions in HPC are first calcined into Fe3O4 and then react with sulfur under vacuum conditions to synthesize FeS2. HPC, with micro-porous shells and inter-connected macro-porous carbon capsules, shows highly ionic/electrical conductivities and efficient buffer effect on the volume change of FeS2. FeS2@HPC exhibits a high specific capacity of 907 mAh·g−1 in the first cycle and remains 720 mAh·g−1 after 100 cycles at the rate of 1 C.