Objectives: We examined the association between physical activity and cognitive functioning in middle age. Methods: Data were derived from a prospective occupational cohort study of 10308 civil servants aged 35-55 years at baseline (phase 1; 1985-1988). Physical activity level, categorized as low, medium, or high, was assessed at phases 1, 3 (1991-1994), and 5 (1997-1999). Cognitive functioning was tested at phase 5, when respondents were 46-68 years old. Results: In both prospective (odds ratio [OR] = 1.65; 95% confidence interval [CI] = 1.30, 2.10) and cross-sectional (OR = 1.79; 95% CI = 1.38, 2.32) analyses, low levels of physical activity were a risk factor for poor performance on a measure of fluid intelligence. Analyses aimed at assessing cumulative effects (summary of physical activity levels at the 3 time points) showed a graded linear relationship with fluid intelligence, with persistently low levels of physical activity being particularly harmful (OR = 2.21; 95% CI = 1.37, 3.57). Conclusions: Low levels of physical activity are a risk factor for cognitive functioning in middle age, fluid intelligence in particular.