TRP channels are implicated in various diseases, but high structural similarity between them makes selective pharmacological modulation challenging. Here, we study the molecular mechanism underlying specific inhibition of the TRPM7 channel, which is essential for cancer cell proliferation, by the anticancer agent CCT128930 (CCT). Using cryo-EM, functional analysis, and MD simulations, we show that CCT binds to a vanilloid-like (VL) site, stabilizing TRPM7 in the closed non-conducting state. Similar to other allosteric inhibitors of TRPM7, NS8593 and VER155008, binding of CCT is accompanied by displacement of a lipid that resides in the VL site in the apo condition. Moreover, we demonstrate the principal role of several residues in the VL site enabling CCT to inhibit TRPM7 without impacting the homologous TRPM6 channel. Hence, our results uncover the central role of the VL site for the selective interaction of TRPM7 with small molecules that can be explored in future drug design.