We present a novel method for the efficient generation of even, odd, and helical Mathieu-Gauss beams of arbitrary order and ellipticity by means of a phase-only spatial light modulator (SLM). Our method consists of displaying the phase of the desired beam in the SLM; the reconstructed field is obtained on-axis following a spatial filtering process with an annular aperture. The propagation invariance and topological properties of the generated beams are investigated numerically and experimentally.