Background: Health effects of air pollution on diabetes have been scarcely studied in developing countries. We aimed to explore the associations of long-term exposure to ambient particulate matter (PM) and gaseous pollutants with diabetes prevalence and glucose-homoeostasis markers in China. Methods: Between April 1 and Dec 31, 2009, we recruited a total of 15 477 participants aged 18–74 years using a random number generator and a four-staged, stratified and cluster sampling strategy from a large cross-sectional study (the 33 Communities Chinese Health Study) from three cities in Liaoning province, northeastern China. Fasting and 2 h insulin and glucose concentrations and the homoeostasis model assessment of insulin resistance index and β-cell function were used as glucose-homoeostasis markers. Diabetes was defined according to the American Diabetes Association's recommendations. We calculated exposure to air pollutants using data from monitoring stations (PM with an aerodynamic diameter of 10 μm or less [PM10], sulphur dioxide, nitrogen dioxide, and ozone) and a spatial statistical model (PM with an aerodynamic diameter of 1 μm or less [PM1] and 2·5 μm or less [PM2·5]). We used two-level logistic regression and linear regression analyses to assess associations between exposure and outcomes, controlling for confounders. Findings: All the studied pollutants were significantly associated with increased diabetes prevalence (eg, the adjusted odds ratios associated with an increase in IQR for PM1, PM2·5, and PM10 were 1·13, 95% CI 1·04–1·22; 1·14, 1·03–1·25; and 1·20, 1·12–1·28, respectively). These air pollutants were also associated with higher concentrations of fasting glucose (0·04–0·09 mmol/L), 2 h glucose (0·10–0·19 mmol/L), and 2 h insulin (0·70–2·74 μU/L). No association was observed for the remaining biomarkers. Stratified analyses indicated greater effects on the individuals who were younger (<50 years) or overweight or obese. Interpretation: Long-term exposure to air pollution was associated with increased risk of diabetes in a Chinese population, particularly in individuals who were younger or overweight or obese. Funding: The National Key Research and Development Program of China, the National Natural Science Foundation of China, the Fundamental Research Funds for the Central Universities, the Guangdong Province Natural Science Foundation, the Career Development Fellowship of Australian National Health and Medical Research Council, and the Early Career Fellowship of Australian National Health and Medical Research Council.