OBJECTIVE To assess the contribution of modifiable risk factors to social inequalities in the incidence of type 2 diabetes when these factors are measured at study baseline or repeatedly over follow-up and when long term exposure is accounted for. DESIGN Prospective cohort study with risk factors (health behaviours (smoking, alcohol consumption, diet, and physical activity), body mass index, and biological risk markers (systolic blood pressure, triglycerides and high density lipoprotein cholesterol)) measured four times and diabetes status assessed seven times between 1991-93 and 2007-09. SETTING Civil service departments in London (Whitehall II study). PARTICIPANTS 7237 adults without diabetes (mean age 49.4 years; 2196 women). MAIN OUTCOME MEASURES Incidence of type 2 diabetes and contribution of risk factors to its association with socioeconomic status. RESULTS Over a mean follow-up of 14.2 years, 818 incident cases of diabetes were identified. Participants in the lowest occupational category had a 1.86-fold (hazard ratio 1.86, 95% confidence interval 1.48 to 2.32) greater risk of developing diabetes relative to those in the highest occupational category. Health behaviours and body mass index explained 33% (-1% to 78%) of this socioeconomic differential when risk factors were assessed at study baseline (attenuation of hazard ratio from 1.86 to 1.51), 36% (22% to 66%) when they were assessed repeatedly over the follow-up (attenuated hazard ratio 1.48), and 45% (28% to 75%) when long term exposure over the follow-up was accounted for (attenuated hazard ratio 1.41). With additional adjustment for biological risk markers, a total of 53% (29% to 88%) of the socioeconomic differential was explained (attenuated hazard ratio 1.35, 1.05 to 1.72). CONCLUSIONS Modifiable risk factors such as health behaviours and obesity, when measured repeatedly over time, explain almost half of the social inequalities in incidence of type 2 diabetes. This is more than was seen in previous studies based on single measurement of risk factors.