Magnetotactic bacteria biosynthesize magnetite nanoparticles of high structural and chemical purity that allow them to orientate in the geomagnetic field. In this work we have followed the process of biomineralization of these magnetite nanoparticles. We have performed a time-resolved study on magnetotactic bacteria Magnetospirillum gryphiswaldense strain MSR-1. From the combination of magnetic and structural studies by means of Fe K-edge X-ray absorption near edge structure (XANES) and high-resolution transmission electron microscopy we have identified and quantified two phases of Fe (ferrihydrite and magnetite) involved in the biomineralization process, confirming the role of ferrihydrite as the source of Fe ions for magnetite biomineralization in M. gryphiswaldense. We have distinguished two steps in the biomineralization process: the first, in which Fe is accumulated in the form of ferrihydrite, and the second, in which the magnetite is rapidly biomineralized from ferrihydrite. Finally, the XANES analysis suggests that the origin of the ferrihydrite could be at bacterial ferritin cores, characterized by a poorly crystalline structure and high phosphorus content.