The study investigated the direct and mediated effects of mastery and performance goals, negative affect, and task-irrelevant thoughts on working memory in a sample of undergraduates (N = 177). Results indicated that negative affect mediated the positive relation between mastery goals and working memory; students with mastery goals reported decreased negative affect, which in turn was related to enhanced working-memory functioning. In contrast, performance goals had a negative indirect relation to working memory by increasing negative affect. After controlling for negative affect, there was also a positive relation between performance goals and working memory for males, but not for females. Finally, task-irrelevant thoughts were not a significant predictor of working memory when negative affect was in the model, and were subsequently removed from the model. implications for the relation between achievement goals, working memory, and cognitive outcomes are discussed.