Different forms of learning and memory depend on functionally and anatomically separable neural circuits [Squire, L. R. (1992) Psychol. Rev. 99, 195-231]. Declarative memory relies on a medial temporal lobe system, whereas habit learning relies on the striatum [Cohen, N. J. & Eichenbaum, H. (1993) Memory, Amnesia, and the Hippocampal System (MIT Press, Cambridge, MA)]. How these systems are engaged to optimize learning and behavior is not clear. Here, we present results from functional neuroimaging showing that the presence of a demanding secondary task during learning modulates the degree to which subjects solve a problem using either declarative memory or habit learning. Dual-task conditions did not reduce accuracy but reduced the amount of declarative learning about the task. Medial temporal lobe activity was correlated with task performance and declarative knowledge after learning under single-task conditions, whereas performance was correlated with striatal activity after dual-task learning conditions. These results demonstrate a fundamental difference in these memory systems in their sensitivity to concurrent distraction. The results are consistent with the notion that declarative and habit learning compete to mediate task performance, and they suggest that the presence of distraction can bias this competition. These results have implications for learning in multitask situations, suggesting that, even if distraction does not decrease the overall level of learning, it can result in the acquisition of knowledge that can be applied less flexibly in new situations.