  Fast radio bursts (FRBs) are short pulses observed in radio frequencies
usually originating from cosmological distances. The discovery of FRB 200428
and its X-ray counterpart from the Galactic magnetar SGR J1935+2154 suggests
that at least some FRBs can be generated by magnetars. However, the majority of
X-ray bursts from magnetars are not associated with radio emission. The fact
that only in rare cases can an FRB be generated raises the question regarding
the special triggering mechanism of FRBs. Here we report a giant glitch from
SGR J1935+2154, which occurred approximately $3.1\pm2.5$\,day before FRB
200428, with $\Delta\nu=19.8\pm1.4$ {\rm $\mu$Hz} and
$\Delta\dot{\nu}=6.3\pm1.1$\,pHz s$^{-1}$. The corresponding spin-down power
change rate $\Delta\dot\nu/\dot\nu$ is among the largest in all the detected
pulsar glitches. The glitch contains a delayed spin-up process that is only
detected in the Crab pulsar and the magnetar 1E 2259+586, a large persistent
offset of the spin-down rate, and a recovery component which is about one order
of magnitude smaller than the persistent one. The temporal coincidence between
the glitch and FRB 200428 suggests a physical connection between the two. The
internally triggered giant glitch of the magnetar likely altered the
magnetosphere structure dramatically in favour of FRB generation, which
subsequently triggered many X-ray bursts and eventually FRB 200428 through
additional crustal cracking and Alfv\'en wave excitation and propagation.
