Let \(E/\mathbb {Q}\) be an elliptic curve and let p be an odd prime of good reduction for E. Assume that E admits a rational p-isogeny \(\varphi :E\rightarrow E'\) , and let \(\phi :G_{\mathbb {Q}}\rightarrow \mathbb {F}_p^\times \) be the character by which \(G_{\mathbb {Q}}\) acts on \(\textrm{ker}(\varphi )\) . In this paper, we prove the Iwasawa main conjecture for E, as formulated by B. Mazur in 1972, when \(\phi \vert _{G_p}\ne 1,\omega \) , where \(G_p\subset G_{\mathbb {Q}}\) is a decomposition group at p and \(\omega \) is the Teichmüller character. Two key innovations in our proof are a Kolyvagin system argument for the Selmer group of E twisted by anticyclotomic Hecke characters arbitrarily close to the trivial character, and a congruence argument exploiting Beilinson–Flach classes and their explicit reciprocity laws.