The fundamental metallicity relation (FMR) states that galaxies of the same stellar mass but larger star formation rate (SFR) tend to have smaller gas-phase metallicity (<Zg>). It is thought to be fundamental because it naturally arises from the stochastic feeding of star-formation from external metal-poor gas accretion, a process extremely elusive to observe but essential according the cosmological simulations of galaxy formation. In this letter, we show how the FMR emerges from the local anti-correlation between SFR surface density and Zg recently observed to exist in disk galaxies. We analytically derive the global FMR from the local law, and then show that both relations agree quantitatively when considering the star-forming galaxies of the MaNGA survey. Thus, understanding the FMR becomes equivalent to understanding the origin of the anti-correlation between SFR and metallicity followed by the set of star-forming regions of any typical galaxy. The correspondence between local and global laws is not specific of the FMR, so that a number of local relations should exist associated with known global relations.