THE Earth's magnetic field provides an important source of directional information for terrestrial organisms1-5, but the sensory receptor or receptors responsible for magnetic field detection have yet to be identified. Theoretical models of the mechanism of magnetoreception have implicated specialized photoreceptors6,7. The proposed mechanisms would amplify the weak interaction of the geomagnetic field with a single electron spin to the level of photon detection, resulting in a modulation of the photoreceptor response to light. Although behavioural8,9 and neurophysiological10-12 studies have established a link between magnetic field sensitivity and the visual system, definitive evidence for the use of a light-dependent magnetoreception mechanism has been lacking. Here we show that magnetic compass orientation in a semiaquatic salamander is affected by the wavelength of light13, and that this wavelength-dependence is due to a direct effect of light on the underlying magnetoreception mechanism.