Transition metal compound (TMC)/carbon hybrids, as prospering electrocatalyst, have attracted great attention in the field of oxygen reduction reaction (ORR). Their morphology, structure and composition often play a crucial role in determining the ORR performance. In this work, we for the first time report the successful fabrication of porous core-shell Fe1-xS@N, S co-doped carbon (Fe1-xS@NSC-t, t represents etching time) by a novel in situ self-template induced strategy using Fe3O4 nanospheres and pyrrole as sacrificial self-template. The post-polymerization of pyrrole can be accomplished by the Fe3+ released through the etching of Fe3O4 by HCl acid. Thus, the etching time has a significant effect on the morphology, structure, composition and ORR performance of Fe1-xS@NSC-t. Based on the characterizations, we find Fe1-xS@NSC-24 can realize effective and balanced combination of Fe1-xS and NSC, possessing porous core-shell architecture, optimized structure defect, specific surface area and doped heteroatoms configurations (especially for pyridinic N, graphitic N and Fe-N structure). These features thus lead to outstanding catalytic activity and cycling stability towards ORR. Our work provides a good guidance on the design of TMC/carbon-based electrodes with unique stable morphology and optimized structure and composition. (C) 2020 Science Press and Dalian Institute of Chemical Physics, Chinese Academy of Sciences. Published by ELSEVIER B.V. and Science Press. All rights reserved.