This cross-sectional study aimed to investigate the quality of care of diabetes in Shanghai, China. A total of 173 235 patients with type 2 diabetes in 2017 were included in the analysis. Profiles of risk factors and intermediate outcomes were determined. The patients had a mean age of 66.43±8.12 (standard deviation (SD)) years and a mean diabetes duration of 7.95±5.53 (SD) years. The percentage of patients who achieved the target level for HbA1c (<7.0%) was 48.6%. Patients who achieved the target levels for blood pressure (BP)<130/80 mmHg and low-density lipoprotein-cholesterol (LDL-c)<2.6 mmol/L reached 17.5% and 34.0%, respectively. A total of 3.8% achieved all three target levels, and the value increased to 6.8% with an adaptation of the BP target level (<140/90 mmHg) for those over 65 years. Multivariable analysis identified the factors associated with a great likelihood of achieving all three target levels: male, young age, short diabetes duration, low body mass index, macrovascular complications, no microvascular complications, prescribed with lipid-lowering medication, and no prescription of antihypertensive medication. In conclusion, nearly 50% and one-third of the patients with diabetes met the target levels for HbA1c and LDL-c, respectively, with a low percentage achieving the BP target level. The percentage of patients who achieved all three target levels needs significant improvement.