We propose a nonlinear gravity inversion for simultaneously estimating the basement and Moho geometries, as well as the depth of the reference Moho along a profile crossing a passive rifted margin. We approximate the subsurface by an interpretation model composed of four layers. The shallowest represents water and has constant density contrast. The second has a number of sub-layers with constant density contrasts. The complexity of this layer depends on the available a priori information at the study area. The third layer represents the crust and has a predefined horizontal density variation along the profile. Finally, the deepest layer represents the mantle, with constant density contrast. Top and base of third layer represent the basement and Moho, respectively. The constant depth defining the base of the interpretation model defines the reference Moho. To obtain stable solutions, we impose smoothness on basement and Moho, force them to be close to previously estimated depths along the profile and also impose local isostatic equilibrium. Differently from previous methods, we introduce the information of local isostatic equilibrium by imposing smoothness on the lithostatic stress exerted at depth. Our method allows deviations from isostatic equilibrium along the profile, so that the interpreter can obtain a set of candidate models that fit the observed data and exhibit different degrees of isostatic equilibrium. Tests with synthetic data show the good performance of our method at regions with pronounced crustal thinning, which is typical of passive volcanic margins. Results obtained at the Pelotas basin, an example of passive volcanic margin at the southern of Brazil, agree with a previous interpretation obtained independently by using seismic data. These results show that, combined with a priori information, our method is a promising tool for interpreting gravity data on passive rifted margins.