  Magnetars are slowly-rotating neutron stars with extremely strong magnetic
fields ($10^{13-15}$ G), episodically emitting $\sim100$ ms long X-ray bursts
with energies of $\sim10^{40-41}$ erg. Rarely, they produce extremely bright,
energetic giant flares that begin with a short ($\sim0.2$ s), intense flash,
followed by fainter, longer lasting emission modulated by the magnetar spin
period (typically 2-12 s), thus confirming their origin. Over the last 40
years, only three such flares have been observed in our local group; they all
suffered from instrumental saturation due to their extreme intensity. It has
been proposed that extra-galactic giant flares likely constitute a subset of
short gamma-ray bursts, noting that the sensitivity of current instrumentation
prevents us from detecting the pulsating tail, while the initial bright flash
is readily observable out to distances $\sim 10-20$ Mpc. Here, we report X- and
gamma-ray observations of GRB 200415A, which exhibits a rapid onset, very fast
time variability, flat spectra and significant sub-millisecond spectral
evolution. These attributes match well with those expected for a giant flare
from an extra-galactic magnetar, noting that GRB 200415A is directionally
associated with the galaxy NGC 253 ($\sim$3.5 Mpc away). The detection of
$\sim3$ MeV photons provides definitive evidence for relativistic motion of the
emitting plasma. The observed rapid spectral evolution can naturally be
generated by radiation emanating from such rapidly-moving gas in a rotating
magnetar.
