Oral antiretroviral agents provide life-saving treatments for millions of people living with HIV, and can prevent new infections via pre-exposure prophylaxis1-5. However, some people living with HIV who are heavily treatment-experienced have limited or no treatment options, owing to multidrug resistance6. In addition, suboptimal adherence to oral daily regimens can negatively affect the outcome of treatment—which contributes to virologic failure, resistance generation and viral transmission—as well as of pre-exposure prophylaxis, leading to new infections1,2,4,7-9. Long-acting agents from new antiretroviral classes can provide much-needed treatment options for people living with HIV who are heavily treatment-experienced, and additionally can improve adherence10. Here we describe GS-6207, a small molecule that disrupts the functions of HIV capsid protein and is amenable to long-acting therapy owing to its high potency, low in vivo systemic clearance and slow release kinetics from the subcutaneous injection site. Drawing on X-ray crystallographic information, we designed GS-6207 to bind tightly at a conserved interface between capsid protein monomers, where it interferes with capsid-protein-mediated interactions between proteins that are essential for multiple phases of the viral replication cycle. GS-6207 exhibits antiviral activity at picomolar concentrations against all subtypes of HIV-1 that we tested, and shows high synergy and no cross-resistance with approved antiretroviral drugs. In phase-1 clinical studies, monotherapy with a single subcutaneous dose of GS-6207 (450 mg) resulted in a mean log10-transformed reduction of plasma viral load of 2.2 after 9 days, and showed sustained plasma exposure at antivirally active concentrations for more than 6 months. These results provide clinical validation for therapies that target the functions of HIV capsid protein, and demonstrate the potential of GS-6207 as a long-acting agent to treat or prevent infection with HIV.