Magnetotactic bacteria are one of the simplest systems that perform biomineralization: organisms that create inorganic materials using biochemistry under genetic control. They synthesize magnetosomes, which are intracellular, membrane-bound nanoscale single crystals of magnetite, a magnetic iron oxide. We studied the magnetism of individual magnetosomes inside individual cells with spectro-ptychography, a new technique of high-resolution X-ray microscopy. Our results help us to understand how the cells biomineralize magnetosomes and their function in the cell ecophysiology. In addition to demonstrating a large improvement in spatial resolution relative to earlier nonptychography studies, the results presented provide insights into magnetosome biomineralization.