Generation of an apparently long-lived lunar magnetic field is a longstanding controversy. Palaeomagnetic studies provide conflicting evidence for both strong intrinsic fields (> 53 µT)1–6 and null fields7 between 1.92–4.25 billion years (Ga) ago, with crustal magnetic anomalies indicating no presence of an intrinsic magnetic field after 3.9 Ga ago8–11. During the intermittent high intensity epoch (IHIE) 3.16–3.85 Ga ago, we show that samples that have recorded strong fields are exclusively high-Ti basalts which, based on recent high resolution geochronology12, were erupted during < 1% of this time period. The short period over which these samples formed suggests that the dynamo was predominantly inactive, as evidenced by the continuous unmagnetized crater record throughout the IHIE, and intense fields were only generated for short periods of time while the high-Ti basalts erupted. A possible mechanism for generating an intermittent dynamo is mantle overturn, triggered by dense and gravitationally unstable Ti-rich cumulates sinking to the core-mantle boundary (CMB). We model this process, considering how Ti-rich diapirs melt and temporarily increase the core heat flux, resulting in the generation of a magnetic field13. We demonstrate that this mechanism is only feasible if magnetic field generation is coeval with the rapid eruption of high-Ti basalts following melting. Rapid ascent of Ti-rich melts is supported by petrological evidence14 and demonstrates a causal link between lunar dynamo generation and high-Ti eruptions of the mare basalts.