Expanding a high level of openness and attracting high-quality foreign direct investment (FDI) while preventing foreign-invested enterprises from relocating to host countries to reduce costs and circumvent environmental regulation (ER) in their home countries, which can transform host countries into “pollution heaven”, present a significant challenge for emerging markets such as China. Based on a theoretical analysis that integrates various frameworks, this study constructs a panel regression model to empirically investigate the relationship between ER and the quality of FDI. This analysis is conducted from the perspectives of administrative means and market mechanisms, utilizing panel data from 267 prefectural-level cities in China spanning the years 2005 to 2021. This study reveals the following conclusions: (1) The implementation of ER significantly enhances the quality of FDI within cities, a conclusion that remains robust across various tests. (2) ER improves the quality of FDI through two key pathways: enhancing green competitiveness and fostering green technological innovation. (3) In comparison to the isolated effects of administrative and market mechanism policies, the synergistic effect of these two approaches proves to be more pronounced in elevating the quality of FDI. (4) ER exerts a significant impact on the quality of FDI, particularly within sub-samples of cities characterized by higher levels of environmental protection and a focus on non-resource-oriented activities. (5) ER has a negative spatial spillover effect on FDI quality. This study serves as a valuable guide for emerging markets to enhance environmental policy effectiveness and assess the potential for a new open economic system.