  We use spatially and temporally resolved maps of stellar population
properties of 300 galaxies from the CALIFA integral field survey to investigate
how the stellar metallicity (Z*) relates to the total stellar mass (M*) and the
local mass surface density ($\mu$*) in both spheroidal and disk dominated
galaxies. The galaxies are shown to follow a clear stellar mass-metallicity
relation (MZR) over the whole 10$^9$ to 10$^{12}$ M$_{\odot}$ range. This
relation is steeper than the one derived from nebular abundances, which is
similar to the flatter stellar MZR derived when we consider only young stars.
We also find a strong relation between the local values of $\mu$* and Z* (the
$\mu$ZR), betraying the influence of local factors in determining Z*. This
shows that both local ($\mu$*-driven) and global (M*-driven) processes are
important in determining the metallicity in galaxies. We find that the overall
balance between local and global effects varies with the location within a
galaxy. In disks, $\mu$* regulates Z*, producing a strong $\mu$ZR whose
amplitude is modulated by M*. In spheroids it is M* who dominates the physics
of star formation and chemical enrichment, with $\mu$* playing a minor,
secondary role. These findings agree with our previous analysis of the star
formation histories of CALIFA galaxies, which showed that mean stellar ages are
mainly governed by surface density in galaxy disks and by total mass in
spheroids.
