The NASA/Ames general circulation model (GCM) has been used to compute time series for the variations in the Stokes coefficients expressing Mars' gravitational field in spherical harmonics. The sources of the variations are changes in the mass distribution of the atmosphere and changes in the planetary ice caps. The latter are due mainly to the condensation and sublimation of CO2 on the surface of Mars. Variations were obtained for coefficients up to degree and order 40, which is the maximum allowed by the spatial definition of the model. The time series covered a period of a full Martian year of 669 sols with a time step of 1.5 hours. The time series were analyzed by means of fast Fourier transforms. The largest variations occur in C10 corresponding to a 27.5-mm displacement of the center of mass in the z-direction. Other geoidal variations are C30 (17.7 mm), C20 (11.4 mm) and C50 (10.0 mm). The main harmonics are annual, (1/2)-annual and (1/3)-annual. Most of the power is due to ice caps variations. Mars Global Surveyor trajectory runs with and without the above orbit perturbations yield RMS differences in total position which range between 4.44 and 17.39 m over a 7-day arc, depending on the season. A 7-day simulated tracking data least squares solution in which some level of the perturbations is absorbed into initial state parameters yields RMS differences between 0.35 and 0.78 m in total position.