We report on the performance of silicon micromachined adaptive mirrors in a closed-loop system designed for correction of primary optical aberrations. The feedback was configured to optimize for the beam brightness, which resulted in efficient minimization of on-axis aberrations. To characterize the performance we used independent interferometric and far-field monitoring of the beam quality. The optimization system provided suitable for high quality quasi-static correction of low-order aberrations with amplitudes of up to several wavelengths. The approach reported has a practical potential in applications ranged from retinal medical imaging to on-board space-based laser communication systems and telescopes.