The Wisconsin Card Sorting Test, which probes the ability to shift attention from one category of stimulus attributes to another (shifting cognitive sets), is the most common paradigm used to detect human frontal lobe pathology. However, the exact relationship of this card test to prefrontal function and the precise anatomical localization of the cognitive shifts involved are controversial. By isolating shift-related signals using the temporal resolution of functional magnetic resonance imaging, we reproducibly found transient activation of the posterior part of the bilateral inferior frontal sulci. This activation was larger as the number of dimensions (relevant stimulus attributes that had to be recognized) were increased. These results suggest that the inferior frontal areas play an essential role in the flexible shifting of cognitive sets.