We present results from the NIRVANDELS survey on the gas-phase metallicity (Zg, tracing O/H) and stellar metallicity (Z⋆, tracing Fe/H) of 33 star-forming galaxies at redshifts 2.95 < z < 3.80. Based on a combined analysis of deep optical and near-IR spectra, tracing the rest-frame far-ultraviolet (FUV; 1200–2000 Å) and rest-frame optical (3400–5500 Å) respectively, we present the first simultaneous determination of the stellar and gas-phase mass-metallicity relationships (MZRs) at z ≃ 3.4. In both cases, we find that metallicity increases with increasing stellar mass (M⋆), and that the power-law slope at M⋆ ≲ 1010M⊙ of both MZRs scales as $Z \propto M_{\star }^{0.3}$. Comparing the stellar and gas-phase MZRs, we present direct evidence for super-solar O/Fe ratios (i.e. α-enhancement) at z > 3, finding (O/Fe) = 2.54 ± 0.38 × (O/Fe)⊙, with no clear dependence on M⋆.