The impact of activity on neuronal circuitry is complex, involving both functional and structural changes whose interaction is largely unknown. We have used optical imaging of mouse visual cortex responses and two-photon imaging of superficial layer spines on layer 5 neurons to monitor network function and synaptic structural dynamics in the mouse visual cortex in vivo. Total lack of vision due to dark-rearing from birth dampens visual responses and shifts spine dynamics and morphologies toward an immature state. The effects of vision after dark rearing are strongly dependent on the timing of exposure: over a period of days, functional and structural changes are temporally related such that light stabilizes spines while increasing visually driven activity. The effects of long-term light exposure can be partially mimicked by experimentally enhancing inhibitory signaling in the darkness. Brief light exposure, however, results in a rapid, transient, NMDA-dependent increase of cortical responses, accompanied by increased dynamics of dendritic spines. These findings indicate that visual experience induces rapid reorganization of cortical circuitry followed by a period of stabilization, and demonstrate a close relationship between dynamic changes at single synapses and cortical network function.