In this paper we propose a new formulation of the Fourier Modal Method based on an alternative treatment of interface conditions allowing us to overcome the effect of the Gibbs phenomenon. Explicit consideration of the interface conditions for the discontinuous part of the field leads to an equation for the eigenvalue problem, which can be written in an inversion-free form. The results of the method are in good agreement with the results for the classical approach based on the Li factorization rules both for dielectric and metallic gratings. Moreover, the developed method allows calculating the near field much more accurately, and may find its applications in sensing and nonlinear optics.