Conditioned place preference (CPP) is a widely used model of addiction-related behavior whose underlying mechanism is not understood. In this study, we used dual site silicon probe recordings in freely moving mice to examine interactions between the hippocampus and nucleus accumbens in cocaine CPP. We found that CPP was associated with recruitment of nucleus accumbens medium spiny neurons (MSNs) to fire in the cocaine-paired location, and this recruitment was driven predominantly by selective strengthening of hippocampal inputs arising from place cells that encode the cocaine-paired location. These findings provide in vivo evidence that the synaptic potentiation in the accumbens caused by repeated cocaine administration preferentially affects inputs that were active at the time of drug exposure. This provides a plausible physiological mechanism by which drug use becomes associated with specific environmental contexts.