A new adaptive finite-element method for solving 3D direct-current resistivity modeling problems is presented. The method begins with an initial coarse mesh, which is then adaptively refined wherever a gradient-recovery-based a posteriori error estimator indicates that refinement is necessary. Then the problem is solved again on the new grid. The alternating solution and refinement steps continue until a given error criterion is satisfied. The method is demonstrated on two synthetic resistivity models with known analytical solutions, so the errors can be quantified. The applicability of the numerical method is illustrated on a 2D homogeneous model with a topographic valley. Numerical results show that this method is efficient and accurate for geometrically complex situations.