Legume-based cropping systems have been promoted as a sustainable alternative to fertilizer-based systems. However, the efficacy of this strategy for mitigating greenhouse gas (GHG) emissions in Mediterranean agroecosystems is still not well known. We conducted two field trials in Mediterranean conditions aiming to compare the soil nitrous oxide (N2O) and methane (CH4) emissions under rainfed triticale (× Triticosecale) monocropped with and without N fertilizer, or in rotation with rainfed faba bean (Vicia faba), rainfed pea (Pisum sativum), or summer-irrigated cowpea (Vigna unguiculata). The effect of incorporation vs. removal of the legume residues was also evaluated. Soil mineral N, moisture contents and GHG fluxes were measured throughout two consecutive years. Legume-based cultivation reduced triticale yield-scaled N2O emissions (YSNE) in a wet year but maintained or even increased YSNE in a dry year. This was mostly due to low N use efficiency (NUE) in the fertilizer-based systems and to favorable conditions for denitrification when rainfall was high. Significant differences in CH4 exchange between systems were only observed in the cowpea-triticale rotation with incorporated residues, which mitigated triticale CH4 emissions in the dry year, possibly due to improved soil aeration and reduced water stress to methanotrophs.We conclude that legume-based farming can be an effective GHG mitigation strategy in Mediterranean agroecosystems, but efficient supplementary N fertilization may be necessary to achieve a reduction in GHG emissions without compromising crop yields.