Identifying efficient pathways to control and modify the order parameter of a macroscopic phase in materials is an important ongoing challenge. One way to do this is via the excitation of a high-frequency mode that couples to the order, and this is the ultimate goal of the field of ultrafast phase transitions1,2. This is an especially interesting research direction in magnetism, where the coupling between spin and lattice excitations is required for magnetization reversal3,4. However, previous attempts5,6 have not demonstrated switching between magnetic states via resonant pumping of phonon modes. Here we show how an ultrafast resonant excitation of the longitudinal optical phonon modes in magnetic garnet films switches magnetization into a peculiar quadrupolar magnetic domain pattern, revealing the magneto-elastic mechanism of the switching. In contrast, the excitation of strongly absorbing transverse phonon modes results in a thermal demagnetization effect only.