Tree stems exchange greenhouse gases with the atmosphere but the magnitude, variability and drivers of these fluxes remain poorly understood. Here, we report stem fluxes of carbon dioxide (CO2), methane (CH4) and nitrous oxide (N2O) in a boreal riparian forest, and investigate their spatiotemporal variability and ecosystem level importance. For two years, we measured CO2 and CH4 fluxes on a monthly basis in 14 spruces (Picea abies) and 14 birches (Betula pendula) growing near a headwater stream affected by historic ditching. We also measured N2O fluxes on three occasions. All tree stems were net emitters of CO2 and CH4, while N2O fluxes were around zero. CO2 fluxes correlated strongly with air temperature and peaked in summer. CH4 fluxes correlated modestly with air temperature and solar radiation and peaked in late winter and summer. Trees with larger stem diameter emitted more CO2 and less CH4 and trees closer to the stream emitted more CO2 and CH4. The CO2 and CH4 fluxes did not differ between spruce and birch, but correlations of CO2 fluxes with stem diameter and distance to stream differed between the tree species. The absence of vertical trends in CO2 and CH4 fluxes along the stems and their low correlation with groundwater levels and soil CO2 and CH4 partial pressures suggest tree internal production as the primary source of stem emissions. At the ecosystem level, the stem CO2, CH4 and N2O emissions represented 52 ± 16 % of the forest floor CO2 emissions and 3 ± 1 % and 11 ± 40 % of the forest floor CH4 and N2O uptake, respectively, during the snow-free period (median ± SE). The six month snow-cover period contributed 11 ± 45 % and 40 ± 29 % to annual stem CO2 and CH4 emissions, respectively. Overall, the stem gas fluxes were more typical for upland rather than wetland ecosystems likely due to historic ditching and subsequent groundwater level decrease.