We studied atomic spin resonance induced by atomic motion in a spatially periodic magnetostatic field. A rubidium atomic beam, with a velocity of about 400 m s−1, was obliquely incident to a transmission magnetic grating that produced a spatially periodic magnetic field. The magnetic grating was formed by a magnetic thin film on a polyimide substrate that had multiple slits at 150 μm intervals. The atoms experienced field oscillation, depending on their velocity and the field period when passing through the grating, and underwent magnetic resonance. Resonance spectra obtained with a perpendicular magnetization film were in clear contrast to ones obtained with an in-plane magnetization film. The former exhibited resonance peaks at odd multiples of the frequency, determined by the velocity over the period, while the latter had dips at the same frequencies.