The invasive emerald ash borer (Agrilus planipennis) causes damages to street trees estimated to reach US$ 900 million over the next 30 years.Although millions of dollars are spent annually to control this species, such approaches are often based on heuristics. Here, we reveal an optimal management strategy to protect urban trees in North America from A. planipennis. To achieve this, we embedded a pest dispersal model within a mixed integer programming framework. We discovered that optimized strategies consistently outperformed those based on heuristics, potentially resulting in the protection of an additional nearly one million street trees and savings of $ 627 million. Critically, the best management strategies always relied on quarantines and biological control (constituting 83-95% and 5-17% of the project budget, respectively), in contrast with current practices, which have shifted responsibility for quarantines to state authorities. Our findings serve to inform future pest control efforts, and can potentially protect many more trees from this invasive species.