PurposeThe fast and flexible development of fast switching electromagnetic valves as used in modern gasoline engine demands the availability of efficient and accurate simulation tools. The purpose of this paper is to provide an enhanced computational scheme of these actuators including all relevant physical effects of magneto‐mechanical systems and including contact mechanics.Design/methodology/approachThe finite element (FE) method is applied to efficiently solve the arising coupled system of partial differential equations describing magneto‐mechanical systems. The algorithm for contact mechanics is based on the cross‐constraint method using an energy‐ and momentum‐conserving time‐discretisation scheme. Although solving separately for the electromagnetic and mechanical system, a strong coupling is ensured within each time step by an iterative process with stopping criterion.FindingsThe numerical simulations of the full switching cycle of an electromagnetic direct injection valve, including the bouncing during the closing state, are just feasible with an enhanced and robust mechanical contact algorithm. Furthermore, the solution of the nonlinear electromagnetic and mechanical equations needs a Newton scheme with a line search scheme for the relaxation of the step size.Originality/valueThe paper provides a numerical simulation scheme based on the FE method, which includes all relevant physical effects in magneto‐mechanical systems, and which is robust even for long‐term contact periods with multitude re‐opening phases.