  Magnetic-field sensing has contributed to the formulation of the
plate-tectonics theory, the discovery and mapping of underground structures on
Earth, and the study of magnetism in other planets. Filling the gap between
space-based and near-Earth observation, we demonstrate a novel method for
remote measurement of the geomagnetic field at an altitude of 85-100 km. The
method consists of optical pumping of atomic sodium in the upper mesosphere
with an intensity-modulated laser beam, and simultaneous ground-based
observation of the resultant magneto-optical resonance when driving the
atomic-sodium spins at the Larmor precession frequency. The experiment was
carried out at the Roque de Los Muchachos Observatory in La Palma (Canary
Islands) where we validated this technique and remotely measured the Larmor
precession frequency of sodium as 260.4(1) kHz, corresponding to a mesospheric
magnetic field of 0.3720(1) G. We demonstrate a magnetometry accuracy level of
0.28 mG/$\sqrt{\text{Hz}}$ in good atmospheric conditions. In addition, these
observations allow us to characterize various atomic-collision processes in the
mesosphere. Remote detection of mesospheric magnetic fields has potential
applications such as mapping of large-scale magnetic structures in the
lithosphere and the study of electric-current fluctuations in the ionosphere.
