Micro/nanostructured Co9S8 cubes and spheres (S-Co9S8) were successfully prepared with Co3O4 as templates via the vapor-based anion exchange reaction. The morphology and structure of both materials were characterized by SEM and XRD. Co9S8 microcubes and microspheres were composed of nanoparticles, inheriting the micro/nanostructure of Co3O4 precursors. Tested in lithium ion batteries, C-Co9S8 and S-Co9S8 anodes exhibited high specific capacities, excellent cycle stability (C-Co9S8: 369mAhg−1, S-Co9S8: 370mAhg−1 over 300 cycles at 1C) and high rate performances (C-Co9S8: 450mAhg−1, S-Co9S8: ∼430mAhg−1 at 5C).