Introduction: Weight gain after starting antiretroviral therapy (ART) is a major problem that can increase morbidity. Our main objective was to evaluate the effects of initial ART on weight change in a large prospective cohort of HIV-positive individuals. Methods: This was a prospective cohort study of 13,198 subjects included in the Spanish HIV Research Network (CoRIS) between January 2004 and November 2018. We included subjects who started triple ART and achieved HIV RNA suppression within 48 weeks. We fitted linear mixed models adjusted for potential confounders to compare longitudinal changes in weight. We used Cox proportional-hazard models to compare treatment groups' times to transition to a higher body mass index (BMI) category. Results: We analysed data from a total of 1631 individuals resulting in 14,965 persons/years and 14,085 observations. Individuals retained in the final multivariable model were representative of the overall cohort. NNRTI-based first-line ART was associated with a lower average weight gain compared to PI-(+0.7 kg per year, 95% CI 0.5 to 1.0, p < 0.001) and INSTIbased (+0.9 kg per year, 95% CI 0.7 to 1.1, p < 0.001) regimens. Individuals starting ART with TAF+FTC had greater weight gain than those receiving TDF+FTC (+0.8 kg per year, 95% CI 0.3 to 1.4, p = 0.004). Women and black persons presented a greater weight gain than men and non-black individuals. Differences in weight trajectories were driven mainly by changes during the first year of ART. The NNRTI group was less likely to transition from normal weight to overweight than the PI (aHR 1.48, 95% CI 1.18 to 1.85) and INSTI groups (aHR 1.30, 95% CI 1.03 to 1.64). PIs but not INSTIs were associated with a higher rate of overweight-to-obesity shift (aHR 2.17, 95% CI 1.27 to 3.72). No differences were found among INSTIs in the transition to a higher BMI category. Conclusions: INSTI-and PI-based first-line ARTs are associated with greater weight gain compared to NNRTI-based ART. Within the NRTIs, TAF+FTC was most strongly associated with weight gain. This heterogeneous effect of ART on body weight could affect the long-term risk of some non-communicable diseases.