We present the first detection of an X-ray flare from an ultracool dwarf of spectral class L. The event was identified in the EXTraS database of XMM-Newton variable sources, and its optical counterpart, J0331−27, was found through a cross-match with the Dark Energy Survey Year 3 release. Next to an earlier four-photon detection of Kelu-1, J0331−27 is only the second L dwarf detected in X-rays, and much more distant than other ultracool dwarfs with X-ray detections (photometric distance of 240 pc). From an optical spectrum with the VIMOS instrument at the VLT, we determine the spectral type of J0331−27 to be L1. The X-ray flare has an energy of EX, F ∼ 2 × 1033 erg, placing it in the regime of superflares. No quiescent emission is detected, and from 2.5 Ms of XMM-Newton data we derive an upper limit of LX, qui < 1027 erg s−1. The flare peak luminosity (LX, peak = 6.3 × 1029 erg s−1), flare duration (τdecay ≈ 2400 s), and plasma temperature (≈16 MK) are similar to values observed in X-ray flares of M dwarfs. This shows that strong magnetic reconnection events and the ensuing plasma heating are still present even in objects with photospheres as cool as ∼2100 K. However, the absence of any other flares above the detection threshold of EX, F ∼ 2.5 × 1032 erg in a total of ∼2.5 Ms of X-ray data yields a flare energy number distribution inconsistent with the canonical power law dN/dE ∼ E−2, suggesting that magnetic energy release in J0331−27 – and possibly in all L dwarfs – takes place predominantly in the form of giant flares.