HIV infection and antiretroviral therapies have detrimental effects on bone metabolism, but data on their impact on fracture risk are controversial. We conducted a population-based cohort study to explore the association between clinical diagnosis of HIV infection and hip and major osteoporotic fracture risk. Data were obtained from the SIDIAPQ database, which contains clinical information for >2 million patients in Catalonia, Spain (30% of the population). We screened the database to identify participants with a clinical diagnosis of HIV infection, and ascertained incident hip and osteoporotic major fractures in the population aged 40 years or older in 2007 to 2009. In addition, data on incident fractures involving hospital admission were obtained from the Hospital Admissions database. Cox regression models were used to estimate hazard ratios (HRs) for the HIV-infected versus uninfected participants. Models were adjusted for age, sex, body mass index, smoking status, alcohol drinking, oral glucocorticoid use, and comorbid conditions (Charlson index). Among 1,118,156 eligible participants, we identified 2489 (0.22%) subjects with a diagnosis of HIV/AIDS. Age- and sex-adjusted HR for HIV/AIDS were 6.2 (95% confidence interval [CI] 3.5–10.9; p < 0.001) and 2.7 (2.01–3.5; p < 0.001) for hip and major fractures, respectively; this remained significant after adjustment for all mentioned potential confounders: HR 4.7 (2.4–9.5; p < 0.001) and 1.8 (1.2–2.5; p = 0.002). After stratifying by age, the association between HIV infection and major fractures was attenuated for those aged <59 years (adjusted HR 1.35 [0.88–2.07], p = 0.17) but appeared stronger in older patients (adjusted HR 2.11 [1.05–4.22], p = 0.035). We report a strong association between HIV infection and hip fracture incidence, with an almost fivefold increased risk in the HIV infected, independent of sex, age, smoking, alcohol drinking, and comorbidities. Similarly, we demonstrate a 75% higher risk of all clinical fractures and a 60% increase in risk of non-hip clinical fractures among patients with a diagnosis of HIV infection.