The impact of hepatitis B vaccination in men having sex with men in Amsterdam has been marginal until now, possibly because of increases in sexual risk behaviour counterbalancing the effect of vaccination. A mathematical model is used to describe the hepatitis B epidemic. The model shows that, with the current vaccination coverage, the decrease in incidence is small in the beginning. However, the number of infections prevented per vaccine administered rises over time. Nevertheless, increased risk behaviour reduces the benefit of vaccination. Targeting high-risk men is more successful in reducing and containing the epidemic than targeting low-risk men. In conclusion, the vaccination campaign is effective and should be intensified. High-risk men should be targeted for vaccination and for risk reduction.