Mercury is surrounded by a tenuous, collisionless exosphere where the surface of the planet is directly exposed to the space environment. As a consequence, impacts and space weathering processes are expected to eject atoms and molecules from the surface into the exosphere, implying a direct link between the exospheric composition and the planet's regolith material. However, observational evidence demonstrating this link has been elusive. Here we report that exospheric magnesium, a species recently discovered and systematically measured by the Mercury Surface, Space ENvironment, GEochemistry, and Ranging mission, is enhanced when observed over a portion of the planet's surface regolith rich in magnesium. These observations confirm a direct link between Mercury's magnesium exosphere and the underlying crustal surface composition, providing strong evidence supporting theoretical arguments that impact vaporization can directly supply material to the exosphere from the regolith of a rocky, airless body.