A novel solvent-free thermal reaction of ferrocene and sulfur is developed for preparing iron sulfide and carbon nanocomposites, where ferrocene acts as both iron and carbon source. The prepared composite has iron sulfide sandwiched in carbon matrix. Moreover, ferrocene and sulfur can turn to vapor phase at an elevated temperature, resulting in easy deposition of product on the surface of templates. Sodium chloride was selected as a template due to its nontoxic and water-soluble nature. The NaCl-templated composite shows “sphere on mattress” morphology and exhibits the highest capacity and the longest cyclability ever reported for iron pyrite anode. To obtain mesoporous nanocomposites, SBA-15 was also applied as templates. The mesoporous nanocomposite demonstrates excellent capacity retention capability, indicating the robust structural stability.