Depression is the most common mental illness and contributes to a huge disease burden. However, few studies have examined the association between ambient temperature on depression. In this study, a three times repeated survey was conducted in 24 communities nationwide in China, through a face-to-face interview. Weather and air pollution data were collected from the European Centre for Medium-Range Weather Forecasts and the China National Environmental Monitoring Center, respectively. Depression was diagnosed by the 9-item Patient Health Questionnaire and generalized estimation equation models were used to examine the effects of ambient temperature on depression. Finally, 3811 individuals participated in the baseline survey, and a total of 9814 visits were completed during the three repeated survey periods. The relationship between ambient temperature and depression was linear. After adjusting for potential confounders, we observed that every 5 °C reduction in the two-week moving average temperature was associated with a 15.6% increase in depression (odds ratio (OR) = 1.156, 95% confidence interval (CI): 1.009–1.324, P= 0.038). Subgroup analyses showed that people aged ⩾65 years (OR = 1.269, 95% CI: 1.082–1.489, P< 0.01) were more vulnerable than those aged <65 years (OR = 0.873, 95% CI: 0.703–1.084, P= 0.22), while women (OR = 1.250, 95% CI: 1.054–1.483, P < 0.01) were more vulnerable than men (OR = 0.947, 95% CI: 0.771–1.162, P = 0.68). Results of the present study support an association between lower temperatures and increased risk of depression.