Resonant acceleration of electrons by a laser in the background of an extra longitudinal magnetic field is investigated analytically and numerically. The resonant condition is independent of laser intensity, and when satisfied, the energy gain is proportional to $a_0^2 $ and the square of phase difference. This process is mainly limited by the magnitude and spatial size of the extra magnetic field. Under the laboratory conditions, simulation results show that a monoenergetic and collimated electron bunch can still be obtained in ~ GV/cm scale, which sheds a light on the vacuum table-top laser-driven electron accelerators.