Abstract. We present observations of XRF 050406, the first burst detected by Swift showing a flare in its X-ray light curve. During this flare, which peaks at t peak ∼ 210 s after the BAT trigger, a flux variation of δF/F ∼ 6 in a very short time δt/t peak ≪ 1 was observed. Its measured fluence in the 0.2-10 keV band was ∼ 1.4 × 10 −8 erg cm −2 , which corresponds to 1-15% of the prompt fluence. We present indications of spectral variations during the flare. We argue that the producing mechanism is late internal shocks, which implies that the central engine is still active at 210 s, though with a reduced power with respect to the prompt emission. The X-ray light curve flattens to a very shallow slope with decay index of ∼ 0.5 after ∼ 4400 s, which also supports continued central engine activity at late times. This burst is classified as an X-ray flash, with a relatively low fluence (∼ 10 −7 erg cm −2 in the 15-350 keV band, E iso ∼ 10 51 erg), a soft spectrum (photon index 2.65), no significant flux above ∼ 50 keV and a peak energy E p < 15 keV. XRF 050406 is one of the first examples of a well-studied X-ray light curve of an XRF. We show that the main afterglow characteristics are qualitatively similar to those of normal GRBs. In particular, X-ray flares superimposed on a power-law light curve have now been seen in both XRFs and GRBs. This indicates that a similar mechanism may be at work for both kinds of events.