Tropical peatlands play an important role in the global carbon cycling but little is known about factors regulating carbon dioxide (CO2) and methane (CH4) fluxes from these ecosystems. Here, we test the hypotheses that (i) CO2 and CH4 are produced mainly from surface peat and (ii) that the contribution of subsurface peat to net C emissions is governed by substrate availability. To achieve this, in situ and ex situ CO2 and CH4 fluxes were determined throughout the peat profiles under three vegetation types along a nutrient gradient in a tropical ombrotrophic peatland in Panama. The peat was also characterized with respect to its organic composition using 13C solid state cross-polarization magic-angle spinning nuclear magnetic resonance spectroscopy. Deep peat contributed substantially to CO2 effluxes both with respect to actual in situ and potential ex situ fluxes. CH4 was produced throughout the peat profile with distinct subsurface peaks, but net emission was limited by oxidation in the surface layers. CO2 and CH4 production were strongly substrate-limited and a large proportion of the variance in their production (30% and 63%, respectively) was related to the quantity of carbohydrates in the peat. Furthermore, CO2 and CH4 production differed between vegetation types, suggesting that the quality of plant-derived carbon inputs is an important driver of trace gas production throughout the peat profile. We conclude that the production of both CO2 and CH4 from subsurface peat is a substantial component of the net efflux of these gases, but that gas production through the peat profile is regulated in part by the degree of decomposition of the peat.