We study optimal spatial policies in quantitative trade and geography frameworks with spillovers and sorting of heterogeneous workers. We characterize the spatial transfers that must hold in efficient allocations, as well as labor subsidies that would implement them. Assuming homogeneous workers and constant-elasticity spillovers, a constant labor tax over space restores efficiency regardless of micro heterogeneity in fundamentals. Place-specific subsidies are needed to attain optimal sorting if there are spillovers across different types of workers. We show how to quantify optimal spatial transfers, and apply the framework to data across U.S. cities using existing estimates of the spillover elasticities. The results suggest that the U.S. economy features too much spatial sorting by skill and wage inequality in larger cities relative to efficient allocations.