Objective We studied the risk of dementia in patients with primary Sjögren's syndrome (pSS) using a nationwide, population‐based cohort in Taiwan. Methods Our study analyzed the medical data of the Taiwanese population from 2000 to 2014. We identified 17,072 patients with pSS and 68,270 controls. Dementia risk was analyzed using a Cox proportional hazards regression model stratified by sex, age, and comorbidities. Results A higher incidence of dementia development in the pSS group during the observation period (P = 0.0001). In multivariate analysis adjusted by age groups, gender, and the comorbidities, the adjusted hazard ratio (aHR) of developing dementia was 1.246 (95% CI 1.123–1.384) times greater in the pSS group than in the non‐pSS group. When stratified by sex, age, and comorbidities, the patients with pSS less than 60 years (aHR 1.67, 95% CI 1.16–2.41), and without any comorbidity (aHR 2.27, 95% CI 1.76–2.93) were particularly associated with a higher risk of dementia. Furthermore, the patients with pSS combined with any other comorbidity had an additionally higher risk of dementia (aHR: 3.978, 95% CI 3.309–4.782), also suggesting that pSS was an independent risk factor for the development of dementia. Interpretation Primary Sjogren's syndrome is associated with increased dementia risk and further study is needed to understand why and what the specific dementia phenotypes are.