Magnetotactic bacteria biomineralize iron into magnetite (Fe3O4) nanoparticles that are surrounded by lipid vesicles. These ‘magnetosomes’ have considerable potential for use in bio- and nanotechnological applications because of their narrow size and shape distribution and inherent biocompatibility1, 2, 3. The ability to tailor the magnetic properties of magnetosomes by chemical doping would greatly expand these applications4, 5; however, the controlled doping of magnetosomes has so far not been achieved. Here, we report controlled in vivo cobalt doping of magnetosomes in three strains of the bacterium Magnetospirillum. The presence of cobalt increases the coercive field of the magnetosomes—that is, the field necessary to reverse their magnetization—by 36–45%, depending on the strain and the cobalt content. With elemental analysis, X-ray absorption and magnetic circular dichroism, we estimate the cobalt content to be between 0.2 and 1.4%. These findings provide an important advance in designing biologically synthesized nanoparticles with useful highly tuned magnetic properties.