© 2018 Martínez-Laguna et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited. Background An increased fracture risk has been described as a complication of Type 2 diabetes mellitus (T2DM). Clinical prediction models for general population have a limited predictive accuracy for fractures in T2DM patients. The aim was to develop and validate a clinical prediction tool for the estimation of 5-year hip and major fracture risk in T2DM patients. Methods and results A cohort of newly diagnosed T2DM patients (n = 51,143, aged 50–85, 57% men) was extracted from the Information System for the Development of Research in Primary Care (SIDIAP) database, containing computerized primary care records for >80% of the population of Catalonia, Spain (>6 million people). Patients were followed up from T2DM diagnosis until the earliest of death, transfer out, fracture, or end of study. Cox proportional hazards regression was used to model the 5-year risk of hip and major fracture. Calibration and discrimination were assessed. Hip and major fracture incidence rates were 1.84 [95%CI 1.64 to 2.05] and 7.12 [95%CI 6.72 to 7.53] per 1,000 person-years, respectively. Both hip and major fracture prediction models included age, sex, previous major fracture, statins use, and calcium/vitamin D supplements; previous ischemic heart disease was also included for hip fracture and stroke for major fracture. Discrimination (0.81 for hip and 0.72 for major fracture) and calibration plots support excellent internal validity. Conclusions The proposed prediction models have good discrimination and calibration for the estimation of both hip and major fracture risk in incident T2DM patients. These tools incorporate key T2DM macrovascular complications generally available in primary care electronic medical records, as well as more generic fracture risk predictors. Future work will focus on validation of these models in external cohorts.