The need for a planned response to a deliberate introduction of smallpox has recently become urgent. We constructed a stochastic simulator of the spread of smallpox in structured communities to compare the effectiveness of mass vaccination versus targeted vaccination of close contacts of cases. Mass vaccination before smallpox introduction or immediately after the first cases was more effective than targeted vaccination in preventing and containing epidemics if there was no prior herd immunity (that is, no prior immunologic protection within the population). The effectiveness of postrelease targeted and mass vaccinations increased if we assumed that there was residual immunity in adults vaccinated before 1972, but the effectiveness of targeted vaccination increased more than that of mass vaccination. Under all scenarios, targeted vaccination prevented more cases per dose of vaccine than did mass vaccination. Although further research with larger-scale structured models is needed, our results suggest that increasing herd immunity, perhaps with a combination of preemptive voluntary vaccination and vaccination of first responders, could enhance the effectiveness of postattack intervention. It could also help targeted vaccination be more competitive with mass vaccination at both preventing and containing a deliberate introduction of smallpox.