Background A vaccine targeting human papillomavirus (HPV) types 16 and 18, which are associated with 80% of anal cancers, is efficacious in men. High-risk populations such as men who have sex with men (MSM) might especially benefit from vaccination. I aimed to estimate the cost-effectiveness of HPV vaccination of MSM in the USA. Methods I constructed decision-analytic models to estimate the direct health and economic outcomes of HPV vaccination (against types 6, 11, 16, and 18) for prevention of HPV-related anal cancer and genital warts. The model parameters that were varied were age at vaccination (12 years, 20 years, and 26 years), previous exposure to vaccine-targeted HPV types, and prevalence of HIV-1. I used the models to conduct sensitivity analyses, including duration of vaccine protection, vaccine cost, and burden of anal cancer and genital warts. Findings In a scenario of HPV vaccination of MSM at 12 years of age without previous exposure to HPV, compared with no vaccination, vaccination cost US$15 290 per quality-adjusted life-year gained. In scenarios where MSM are vaccinated at 20 years or 26 years of age, after exposure to HPV infections, the cost-effectiveness ratios worsened, but were less than $50 000 per quality-adjusted life-year under most scenarios. For example, HPV vaccination of MSM at 26 years cost $37 830 per quality-adjusted life-year when previous exposure to all vaccine-targeted HPV types was assumed to be 50%. Outcomes were most sensitive to variations in anal cancer incidence, duration of vaccine protection, and HIV prevalence in MSM. Interpretation HPV vaccination of MSM is likely to be a cost-effective intervention for the prevention of genital warts and anal cancer.