Environmental pollution is becoming more and more prevalent in China, accompanied by the excessive expansion of the country's foreign direct investment in the scale of resource-based industries. This article uses the panel data of 276 prefecture-level cities in China from 2003 to 2016 to estimate the impact of environmental regulation on foreign direct investment by employing the Spatial Durbin model. The empirical results show that: firstly, environmental regulation, and foreign direct investment have an obvious spatial correlation. Secondly, environmental regulation significantly inhibits foreign direct investment and has significant negative space spillover. Thirdly, non-eastern cities' environmental regulation has significantly greater inhibitory effects on foreign direct investment than eastern cities, and the key cities' environmental regulation has greater inhibitory effects than ordinary cities. Finally, from the perspective of industrial upgrading and resource configuration, environmental regulation has significantly promoted foreign direct investment and have significant negative space spillovers. Therefore, the reasonable use of environmental regulatory measures through industrial upgrading and resource configuration to attract clean, capital-intensive and technology-intensive enterprises and to achieve the effect of "decontamination and clean" for foreign-funded enterprises is critical.