An effective and accurate solver for the direct-current-resistivity forward-modeling problem has become a cutting-edge research topic. However, computational limitations arise due to the substantial amount of data involved, hindering the widespread use of three-dimensional forward modeling, which is otherwise considered the most effective approach for identifying geo-electrical anomalies. An efficient compromise, or potentially an alternative, is found in two-and-a-half-dimensional (2.5D) modeling, which employs a three-dimensional current source within a two-dimensional subsurface medium. Consequently, a Legendre spectral-element algorithm is developed specifically for 2.5D direct-current-resistivity forward modeling, taking into account the presence of topography. This numerical algorithm can combine the complex geometric flexibility of the finite-element method with the high precision of the spectral method. To solve the wavenumber-domain electrical potential variational problem, which is converted into the two-dimensional Helmholtz equation with mixed boundary conditions, the Gauss–Lobatto–Legendre (GLL) quadrature is employed in all discrete quadrilateral spectral elements, ensuring identical Legendre polynomial interpolation and quadrature points. The Legendre spectral-element method is applied to solve a two-dimensional Helmholtz equation and a resistivity half-space model. Numerical experiments demonstrate that the proposed approach yields highly accurate numerical results, even with a coarse mesh. Additionally, the Legendre spectral-element algorithm is employed to simulate the apparent resistivity distortions caused by surface topographical variations in the direct-current resistivity Wenner-alpha array. These numerical results affirm the substantial impact of topographical variations on the apparent resistivity data obtained in the field. Consequently, when interpreting field data, it is crucial to consider topographic effects to the extent they can be simulated. Moreover, our numerical method can be extended and implemented for a more accurate computation of three-dimensional direct-current-resistivity forward modeling.