Using a dynamic model of the control of an infectious disease, we derive the conditions under which eradication will be optimal. When eradication is feasible, the optimal program requires either a low vaccination rate or eradication. A high vaccination rate is never optimal. Under special conditions, the results are especially stark: the optimal policy is either not to vaccinate at all or to eradicate. Our analysis yields a cost-benefit rule for eradication, which we apply to the current initiative to eradicate polio.