A scaling relation has recently been suggested to combine the galaxy mass-metallicity ( MZ ) relation with metallicities of damped Lyman- \alpha systems ( DLAs ) in quasar spectra . Based on this relation the stellar masses of the absorbing galaxies can be predicted . We test this prediction by measuring the stellar masses of 12 galaxies in confirmed DLA absorber - galaxy pairs in the redshift range 0.1 < z < 3.2 . We find an excellent agreement between the predicted and measured stellar masses over three orders of magnitude , and we determine the average offset \langle C _ { \mathrm { [ M / H ] } } \rangle = 0.44 \pm 0.10 between absorption and emission metallicities . We further test if C _ { \mathrm { [ M / H ] } } could depend on the impact parameter and find a correlation at the 5.5 \sigma level . The impact parameter dependence of the metallicity corresponds to an average metallicity difference of -0.022 \pm 0.004 dex kpc ^ { -1 } . By including this metallicity vs. impact parameter correlation in the prescription instead of C _ { \mathrm { [ M / H ] } } , the scatter reduces to 0.39 dex in log M _ { * } . We provide a prescription how to calculate the stellar mass ( M _ { * } ^ { \mathrm { DLA } } ) of the galaxy when both the DLA metallicity and DLA galaxy impact parameter is known . We demonstrate that DLA galaxies follow the MZ relation for luminosity-selected galaxies at z = 0.7 and z = 2.2 when we include a correction for the correlation between impact parameter and metallicity .