Peatlands store substantial amounts of carbon and are vulnerable to climate change. We present a modified version of the Organising Carbon and Hydrology In Dynamic Ecosystems (ORCHIDEE) land surface model for simulating the hydrology, surface energy, and CO2 fluxes of peatlands on daily to annual timescales. The model includes a separate soil tile in each 0.5° grid cell, defined from a global peatland map and identified with peat-specific soil hydraulic properties. Runoff from non-peat vegetation within a grid cell containing a fraction of peat is routed to this peat soil tile, which maintains shallow water tables. The water table position separates oxic from anoxic decomposition. The model was evaluated against eddy-covariance (EC) observations from 30 northern peatland sites, with the maximum rate of carboxylation (Vcmax) being optimized at each site. Regarding short-term day-to-day variations, the model performance was good for gross primary production (GPP) (r2 Combining double low line 0.76; Nash-Sutcliffe modeling efficiency, MEF Combining double low line 0.76) and ecosystem respiration (ER, r2 Combining double low line 0.78, MEF Combining double low line 0.75), with lesser accuracy for latent heat fluxes (LE, r2 Combining double low line 0.42, MEF Combining double low line 0.14) and and net ecosystem CO2 exchange (NEE, r2 Combining double low line 0.38, MEF Combining double low line 0.26). Seasonal variations in GPP, ER, NEE, and energy fluxes on monthly scales showed moderate to high r2 values (0.57-0.86). For spatial across-site gradients of annual mean GPP, ER, NEE, and LE, r2 values of 0.93, 0.89, 0.27, and 0.71 were achieved, respectively. Water table (WT) variation was not well predicted (r2<0.1), likely due to the uncertain water input to the peat from surrounding areas. However, the poor performance of WT simulation did not greatly affect predictions of ER and NEE. We found a significant relationship between optimized Vcmax and latitude (temperature), which better reflects the spatial gradients of annual NEE than using an average Vcmax value.