BackgroundPeople living with HIV might have a poor or delayed response to vaccines, mainly when CD4 cell counts are low, and data concerning COVID-19 vaccines in this population are scarce. This prospective cohort study assessed the safety and immunogenicity of the inactivated SARS-CoV-2 vaccine CoronaVac in people with HIV compared with people with no known immunosuppression.MethodsIn this prospective cohort study, adults (aged ≥18 years) living with HIV who were regularly followed up at the University of Sao Paulo HIV/AIDS outpatient clinic in Sao Paulo, Brazil, were included in the study. Eligibility for people with HIV was independent of antiretroviral use, HIV viral load, or CD4 cell count. Adults with no known immunosuppression with CoronaVac vaccination history were included as a control group. CoronaVac was given intramuscularly in a two-dose regimen, 28 days apart. Blood was collected before vaccine administration and 6 weeks after the second dose (day 69). Immunogenicity was assessed at baseline (day 0), before second vaccine (day 28), and 6 weeks after second vaccine dose (day 69) through SARS-CoV-2 IgG titre and seroconversion, neutralising antibody (NAb) positivity and percentage activity, and factor increase in IgG geometric mean titres (FI-GMT). We investigated whether HIV status and CD4 count (<500 or ≥500 cells per μL) were associated with CoronaVac immunogenicity by use of multivariable models adjusted for age and sex.FindingsBetween Feb 9, 2021, and March 4, 2021, 776 participants were recruited. Of 511 participants included, 215 (42%) were people with HIV and 296 (58%) were people with no known immunosuppression. At 6 weeks after the second vaccine dose (day 69), 185 (91%) of 204 participants with HIV and 265 (97%) of 274 participants with no known immunosuppression had seroconversion (p=0·0055). 143 (71%) of 202 participants with HIV were NAb positive compared with 229 (84%) of 274 participants with no known immunosuppression (p=0·0008). Median IgG titres were 48·7 AU/mL (IQR 26·6–88·2) in people with HIV compared with 75·2 AU/mL (50·3–112·0) in people with no known immunosuppression (p<0·0001); and median NAb activity was 46·2% (26·9–69·7) compared with 60·8% (39·8–79·9; p<0·0001). In people with HIV who had CD4 counts less than 500 cells per μL seroconversion rates, NAb positivity, and NAb activity were lower than in those with CD4 counts of at least 500 cells per μL. In multivariable models for seroconversion, NAb positivity, IgG concentration, and NAb activity after a complete two-dose regimen, adjusted for age and sex, people with HIV who had CD4 counts of at least 500 cells per μL and people with no known immunosuppression had higher immunogenicity than did people with HIV with CD4 counts less than 500 cells per μL. No serious adverse reactions were reported during the study.InterpretationImmunogenicity following CoronaVac in people with HIV seems strong but reduced compared with people with no known immunosuppression. Our findings highlight the need for strategies to improve vaccine immunogenicity in people with HIV.FundingFundação de Amparo à Pesquisa do Estado de São Paulo (FAPESP), Conselho Nacional de Desenvolvimento Científico e Tecnológico (CNPq), and B3—Bolsa de Valores do Brasil.