In contrast with crystallization, there is no noticeable structural change at the glass transition. Characteristic features of glassy dynamics that appear below an onset temperature, T-0 (refs 1-3), are qualitatively captured by mean field theory(4-6), which assumes uniform local structure. Studies of more realistic systems have found only weak correlations between structure and dynamics(7-11). This raises the question: is structure important to glassy dynamics in three dimensions? We answer this question affirmatively, using machine learning to identify a new field, `softness' which characterizes local structure and is strongly correlated with dynamics. We find that the onset of glassy dynamics at T-0 corresponds to the onset of correlations between softness (that is, structure) and dynamics. Moreover, we construct a simple model of relaxation that agrees well with our simulation results, showing that a theory of the evolution of softness in time would constitute a theory of glassy dynamics.