Place cells of the rodent hippocampus fire action potentials when the animal traverses a particular spatial location in a given environment. Therefore, for any given trajectory one will observe a repeatable sequence of place cell activations as the animal explores. Interestingly, when the animal is quiescent or sleeping, one can observe similar sequences of activation, although at a highly compressed rate, known as “replays”. It is hypothesized that this replay underlies the process of memory consolidation whereby memories are “transferred” from hippocampus to cortex. However, it remains unclear how the memory of a particular environment is actually encoded in the place cell activity and what the mechanism for replay is. Here we study how plasticity during spatial exploration shapes the patterns of synaptic connectivity in model networks of place cells. Specifically, we show how plasticity leads to the formation of attracting manifolds: patterns of activity which represent the spatial environment learned. These states become spontaneously active when the animal is quiescent, reproducing the phenomenology of replays. Interestingly, the attractors are formed most rapidly when place cell activity is modulated by an ongoing oscillation. The optimal oscillation frequency can be calculated analytically, is directly related to the plasticity rule, and for experimentally determined values of the plasticity window in rodent slices gives values in the theta range. A major prediction of these model is that the pairwise correlation of place cells which encode for neighboring locations should increase during initial exploration, leading up to the critical transition. We find such an increase in a population of simultaneously recorded CA1 pyramidal cells from a rat exploring a novel track. Furthermore, in a rat in which hippocampal theta is reduced through inactivition of the medial septum we find no such increase. This is consistent with the model, which predicts orders of magnitude lower learning rates when theta is absent.