Returning to a familiar context triggers retrieval of relevant memories, making memories from other contexts less likely to intrude and cause interference. We investigated the physiology that underlies the use of context to prevent interference by recording hippocampal neurons while rats learned two conflicting sets of discrimination problems, either in the same context or in two distinct contexts. Rats that learned the conflicting problem sets in the same context maintained similar neural representations, and performed poorly because conflicting memories interfered with new learning. In contrast, rats that learned in different contexts formed distinct ensemble representations and performed significantly better. We also measured trial-to-trial variation in representations and found that hippocampal activity was directly linked with performance: on trials where an old representation was active, rats were far more likely to make errors. These results show that the formation of distinct hippocampal representations is critical for contextually appropriate memory retrieval. © 2016 Wiley Periodicals, Inc.