Fast and accurate simulation of responses of logging-while-drilling (LWD) electromagnetic (EM) tools in complex 2D and 3D formations is very important for reconstruction of the resistivity distribution in proactive geosteering. Currently, real-time interpretation is based on the 1D parametric inversion. Advances in fast simulation beyond the 1D model would open a way for real-time 2D inversion. We developed, implemented numerically, and tested an efficient method for simulation of LWD EM tools in complex 2D formations with an arbitrary 3D position of the tool. The method is based on the boundary integral equations for the tangential components of the field and the Fourier transform, which reduces the problem to a series of 1D integral equations. Computations are carried out simultaneously for the whole set of measurement points with the same matrix, which provides a short computation time per point. We verified the method by comparing our results with those obtained by the well-known explicit 1D method and by commercial software in the 2D case. Numerical results justified that the method is accurate and time efficient. Also, as an example, we simulated the signals of real propagation and azimuthal resistivity tools for a complex 2D formation model with fault. The software based on our method can be useful in planning geosteering jobs in complex formations.