We present a numerical method for solving Maxwell’s equations in the case of an arbitrary two‐dimensional resistivity distribution excited by an infinite current line. The electric field is computed directly in the time domain. The computations are carried out in the lower half‐space only because exact boundary conditions are used on the free surface. The algorithm follows the finite‐element approach, which leads (after space discretization) to an equation system with a sparse matrix. Time stepping is done with an implicit time scheme. At each time step, the solution of the equation system is provided by the fast system ICCG(0). The resulting algorithm produces good results even when large resistivity contrasts are involved. We present a test of the algorithm’s performance in the case of a homogeneous earth. With a reasonable grid, the relative error with respect to the analytical solution does not exceed 1 percent, even 2 s after the source is turned off.