There are few data assessing the uptake of first-line dolutegravir among men and women living with HIV in low-income and middle-income countries, and subsequent clinical outcomes in non-trial settings. We aimed to determine dolutegravir uptake in women, and the effect of dolutegravir on clinical outcomes in routine care in South Africa. In this cohort study, we analysed deidentified data from adults receiving first-line antiretroviral therapy (ART) at 59 South African clinics from Dec 1, 2019, to Feb 28, 2022, using two distinct cohorts. In the initiator cohort, we used Poisson regression models to assess the outcome of initiation with dolutegravir-based ART by gender, and associations between dolutegravir use and the outcomes of 12-month retention in care and viral suppression at less than 50 copies per mL. In the transition cohort, comprising adults who received non-dolutegravir-based first-line ART in December, 2019, we used Cox proportional hazards models to assess the outcome of transition to first-line dolutegravir by gender. We then used time-dependent propensity score matching to compare the outcomes of subsequent 12-month retention in care and viral suppression between people who transitioned to dolutegravir and those who had not yet transitioned at the same timepoint. In both the initiation and transition cohort, the primary viral load analysis was an intention-to-treat analysis, with a secondary as-treated analysis that excluded people who changed their ART regimen after baseline. In the initiator cohort, between Dec 1, 2019, and Feb 28, 2022, 45 392 people were initiated on ART. 23 945 (52·8%) of 45 392 were non-pregnant women, 4780 (10·5%) were pregnant women, and 16 667 (36·7%) were men. The median participant age was 31·0 years (IQR 26·0-38·0) and 2401 (5·3%) were receiving tuberculosis treatment at time of ART initiation. 31 264 (68·9%) of 45 392 people were initiated on dolutegravir, 14 102 (31·1%) on efavirenz, and 26 (0·1%) on nevirapine. In a univariable Poisson regression model, pregnant women (risk ratio [RR] 0·57, 95% CI 0·49 to 0·66; risk difference -35·4%, 95% CI -42·3 to -28·5) and non-pregnant women (RR 0·78, 0·74 to 0·82; risk difference -18·4%, -21·6 to -15·2) were less likely to be initiated on dolutegravir than were men. In Poisson models adjusted for age, gender (including pregnancy), time, tuberculosis status, and initiation CD4 count, people initiated on dolutegravir were more likely to be retained in care at 12 months (adjusted RR 1·09, 95% CI 1·04 to 1·14; adjusted risk difference 5·2%, 2·2 to 8·4) and virally suppressed (adjusted RR 1·04, 95% CI 1·01 to 1·06; adjusted risk difference 3·1%, 1·2 to 5·1) compared with those initiated on non-dolutegravir-based regimens. For the transition cohort, on Dec 1, 2019, 180 956 people were receiving non-dolutegravir-based first-line ART at the study clinics, of whom 124 168 (68·6%) were women. The median age was 38 years (IQR 32-45), and the median time on ART was 3·9 years (2·0-6·4) years, with most people receiving efavirenz (178 624 [98·7%] people) and tenofovir (178 148 [98·4%]). By Feb 28, 2022, 121 174 (67·0%) of 180 956 people had transitioned to first-line dolutegravir at a median of 283 days (IQR 203-526). In a univariable Cox regression model the hazard of being transitioned to dolutegravir was lower in women than in men (hazard ratio 0·56, 95% CI 0·56 to 0·57). Among 92 318 propensity score matched people, the likelihood of retention in care was higher among the dolutegravir group compared with matched controls (adjusted RR 1·03, 95% CI 1·02 to 1·03; risk difference 2·5%, 95% CI 2·1 to 2·9). In the dolutegravir group, 33 423 (90·5%) of 36 920 people were suppressed at less than 50 copies per mL compared with 31 648 (89·7%) of 35 299 matched controls (adjusted RR 1·01, 95% CI 1·00 to 1·02; risk difference 0·8%, 95% CI 0·3 to 1·4). Women were less likely to receive dolutegravir than men. As dolutegravir was associated with improved outcomes, roll-out should continue, with a particular emphasis on inclusion of women. Wellcome Trust, Africa Oxford Initiative, International Association of Providers of AIDS Care, and Bill & Melinda Gates Foundation. For the isiZulu translation of the abstract see Supplementary Materials section.