The synaptic connectivity of cortex is plastic, with experience shaping the ongoing interactions between neurons. Theoretical studies of spike timing-dependent plasticity (STDP) have focused on either just pairs of neurons or large-scale simulations where analytic insight is lacking. A simple account for how fast spike time correlations affect both micro- and macroscopic network structure remains lacking. We develop a low-dimensional mean field theory showing how STDP gives rise to strongly coupled assemblies of neurons with shared stimulus preferences, with the connectivity actively reinforced by spike train correlations during spontaneous dynamics. Furthermore, the stimulus coding by cell assemblies is actively maintained by these internally generated spiking correlations, suggesting a new role for noise correlations in neural coding. Assembly formation has been often associated with firing rate-based plasticity schemes; our theory provides an alternative and complementary framework, where temporal correlations and STDP form and actively maintain learned structure in cortical networks.