The modeling of the surface mass balance (SMB) of the Greenland ice sheet (GIS) requires high-resolution models in order to capture the observed large gradients in the steep marginal areas. Until now, global climate models have not been considered suitable to model ice sheet SMB due to model biases and insufficient resolution. This study analyzes the GIS SMB simulated for the period 1850-2005 by the Community Earth System Model (CESM), which includes a new ice sheet component with multiple elevation classes for SMB calculations. The model is evaluated against observational data and output from the regional model RACMO2. Because of a lack of major climate biases, a sophisticated calculation of snow processes including surface albedo evolution, and an adequate downscaling technique, CESM is able to realistically simulate GIS surface climate and SMB. CESM SMB agrees reasonably well with in-situ data from 475 locations (r=0.80) and output from RACMO2 (r=0.79). The simulated mean SMB for 1960-2005 is 359±120 Gt yr-1, in the range of estimates from regional climate models. The simulated seasonal mass variability is comparable with mass observations from GRACE, with synchronous annual maximum (May) and minimum (August-September), and similar amplitudes of the seasonal cycle. CESM is able to simulate the bands of precipitation maxima along the SE and NW margins, but absolute precipitation rates are underestimated along the SE margin and overestimated in the high interior. The model correctly simulates the major ablation areas. Total refreezing represents 35% of the available liquid water (the sum of rain and melt).