We analyze the dynamic process of invasive-species control in a spatially explicit and stochastic setting. An integer optimization model is applied to identify optimal strategies to deal with invasive species at a steady state. Optimal strategies depend on the spatial location of invasion as well as on stochastic characteristics of spread and control. Previous studies of invasive-species control have been stochastic or spatial, but not both. We model a landscape as consisting of multiple cells, each of which may be subject to border control or eradication within the cell. Optimal strategies from the model are characterized as eradication, containment, or abandonment of control. Representing the rate of species spread as stochastic rather than deterministic results in less-intensive control becoming optimal at equilibrium. The optimal strategy may switch from eradication to containment or from containment to abandonment. If an infestation occurs at the boundary of the region within which it may spread, it is more likely to be optimal to eradicate or contain the species, compared to an infestation in the interior of the region. If the effectiveness of border control is stochastic, then containment is not feasible in the long term, but it is still optimal as a temporary measure in some scenarios.