Objectives To investigate whether exposure to secondhand smoke (SHS) aggravates the detrimental effect of vitamin D deficiency (VDD) on cognitive performance in the elderly. Methods Based on National Health and Nutrition Examination Surveys (NHANES) 2011–2014, 1,446 non-smoking participants (≥ 60 years old) with detailed serum 25-hydroxyvitamin D [25(OH)D], concentration of cotinine and tests score of cognitive function were included. Cognitive impairment was defined as having a cognitive score in the lowest quartile. The possible synergistic effect of SHS with VDD on cognitive impairment was evaluated by using a multivariable logistic regression model. Results VDD was independently associated with risk of low the Digit Symbol Substitution Test (DSST) scores, increased by nearly 60% [< 34, adjusted odds ratio (aOR) = 1.62, 95% CI: 1.03 ~ 2.53]. Although it only had an association with cognitive impairment indicated by DSST and the Animal Fluency test (AFT) in the crude model, SHS exposure showed significant synergistic effects with VDD on DSST (aOR: 3.03, 95% CI: 1.57 ~ 5.83, P interaction = 0.001) and AFT (aOR: 2.40, 95% CI: 1.34 ~ 4.29, P interaction = 0.003), respectively, after adjusting for the possible confounders. In further stratified analysis, a more obvious synergistic effect of SHS with VDD on DSST (aOR: 4.73, 95%CI:1.77 ~ 12.68, P interaction = 0.002) and AFT (aOR: 5.30, 95%CI: 1.63 ~ 17.24, P interaction = 0.006) was found in obese and overweight subjects, respectively. Conclusion SHS exposure had synergistic effect with VDD on cognitive impairment among elderly and the interaction effect was more obvious in overweight and obese individuals.