The coherence and dephasing of vibrational motions of molecules constitute an integral part of chemical dynamics, influence material properties and underpin schemes to control chemical reactions. Considerable progress has been made in understanding vibrational coherence through spectroscopic measurements, but precise, direct measurement of the structure of a vibrating excited-state polyatomic organic molecule has remained unworkable. Here, we measure the time-evolving molecular structure of optically excited N-methylmorpholine through scattering with ultrashort X-ray pulses. The scattering signals are corrected for the differences in electron density in the excited electronic state of the molecule in comparison to the ground state. The experiment maps the evolution of the molecular geometry with femtosecond resolution, showing coherent motion that survives electronic relaxation and seems to persist for longer than previously seen using other methods.