A combined method for forward and inverse modeling of gravity data is presented. Based on the Fourier transform of Poisson's equation, the forward modeling is suitable for observation points above, within, and below causative masses with any prescribed density distribution. The inversion is linearized in the spatial domain by superimposing numerous prismatic bodies, each having constant but different density, and fixed geometry. Our inversion algorithm adopts a sampling window to reduce memory storage and computations. Testing, with synthetic and field data, demonstrates that a successful inversion can be obtained from crudely estimated a priori density distributions and uncertainties. Lateral variations in density are well resolved but depth resolution often requires better constrained a priori information. Under various a priori conditions, our modeling indicates that sediment density tends to vary exponentially with depth in the San Jacinto basin, southern California.