An improved gain-shaping method for selective mode excitation is presented and its application for the excitation of higher order Hermite–Gaussian modes is demonstrated in an end-pumped Nd:YVO4 laser. Using a digital micromirror device, the intensity distribution of the pump beam within the laser crystal could be shaped with a high degree of freedom. Thus, a broad variety of different gain distributions were achieved, enabling a highly selective mode excitation method based on gain shaping. In the presented experiment, the excitation of nearly 1000 different Hermite–Gaussian modes was demonstrated, increasing the number of excitable Hermite–Gaussian modes by at least a factor of five, compared to other excitation methods. The excited modes include Hermite–Gaussian modes of high orders as, for example, the HG25 , 27 mode. Furthermore, the electronic control of the gain profile, applied via the digital micromirror device, enabled automated measurements of the selective mode excitation. Here, a systematic study is presented to optimize the generated pump patterns with respect to the number of modes that could be excited.