The understanding of corrosion processes of metal implants in the human body is a key problem in modern biomaterial science. Because of the complicated and adjustable in vivo environment, in vitro experiments require the analysis of various physiological corrosion media to elucidate the underlying mechanism of "biological" metal surface modification. In this paper magnesium samples were incubated under cell culture conditions (i.e. including CO(2)) in electrolyte solutions and cell growth media, without and with proteins. Chemical mapping by high resolution electron-induced X-ray emission spectroscopy and infrared reflection microspectroscopy revealed a complex structure of the formed corrosion layer. The presence of CO(2) in concentrations close to that in blood is significant for the chemistry of the oxidized layer. The presence of proteins leads to a less dense but thicker passivation layer which is still ion and water permeable as osmolality and weight measurements indicate.