The study of chemical reactions on the molecular (femtosecond) timescale typically uses pump laser pulses to excite molecules and subsequent probe pulses to interrogate them. The ultrashort pump pulse can excite only a small fraction of molecules, and the probe wavelength must be carefully chosen to discriminate between excited and unexcited molecules. The past decade has seen the emergence of new methods that are also aimed at imaging chemical reactions as they occur, based on X-ray diffraction1, electron diffraction2 or laser-induced recollision3, 4—with spectral selection not available for any of these new methods. Here we show that in the case of high-harmonic spectroscopy based on recollision, this apparent limitation becomes a major advantage owing to the coherent nature of the attosecond high-harmonic pulse generation. The coherence allows the unexcited molecules to act as local oscillators against which the dynamics are observed, so a transient grating technique5, 6 can be used to reconstruct the amplitude and phase of emission from the excited molecules. We then extract structural information from the amplitude, which encodes the internuclear separation, by quantum interference at short times and by scattering of the recollision electron at longer times. The phase records the attosecond dynamics of the electrons, giving access to the evolving ionization potentials and the electronic structure of the transient molecule. In our experiment, we are able to document a temporal shift of the high-harmonic field of less than an attosecond (1 as = 10−18 s) between the stretched and compressed geometry of weakly vibrationally excited Br2 in the electronic ground state. The ability to probe structural and electronic features, combined with high time resolution, make high-harmonic spectroscopy ideally suited to measuring coupled electronic and nuclear dynamics occurring in photochemical reactions and to characterizing the electronic structure of transition states.