Direct current resistivity data acquired on rough terrain can be interpreted by using an appropriate inversion technique after a topographic correction. In order to avoid the influence of a possibly incomplete topographic correction, an improved two-dimensional resistivity inversion algorithm has been developed to estimate the subsurface resistivity distribution in the presence of topography.In this paper, fully discretized modeling is based on the finite-element method, and the iterative inversion scheme is derived from the second-order Marquardt damped least-squares method. The algorithm has been tested on both synthetic and field resistivity data with topography incorporated explicitly into the inversion model. Both theoretical and field studies indicate that the technique is computationally efficient and provides an improved geologic interpretation for complex subsurface structures. A four-electrode configuration is used in the algorithm so that the inversion can represent most field measurements.