Functional neuroimaging studies have implicated alterations in frontostriatal and frontoparietal circuits in obsessive-compulsive disorder (OCD) during various tasks. To date, however, brain activation for visuospatial function in conjunction with symptoms in OCD has not been comprehensively evaluated. To elucidate the relationship between neural activity, cognitive function, and obsessive-compulsive symptoms, we investigated regional brain activation during the performance of a visuospatial task in patients with OCD using functional magnetic resonance imaging (fMRI). Seventeen medication-free patients with OCD and 21 age-, sex-, and IQ-matched healthy controls participated in this study. Functional magnetic resonance imaging data were obtained while the subjects performed a mental rotation (MR) task. Brain activation during the task was compared between the two groups using a two-sample t-test. Voxel-wise whole-brain multiple regression analyses were also performed to examine the relationship between obsessive-compulsive symptom severity and neural activity during the task. The two groups did not differ in MR task performance. Both groups also showed similar task-related activation patterns in frontoparietal regions with no significant differences. Activation in the right dorsolateral prefrontal cortex in patients with OCD during the MR task was positively associated with their total Yale-Brown Obsessive-Compulsive Scale (Y-BOCS) scores. This study identified the specific brain areas associated with the interaction between symptom severity and visuospatial cognitive function during an MR task in medication-free patients with OCD. These findings may serve as potential neuromodulation targets for OCD treatment.