Gamma-ray bursts are the most energetic sources of radiation in the Universe, and half are followed by afterglows that include X-ray flares of mysterious origin. A statistical study of such X-ray flares reveals the same power-law behaviour as solar flares, which suggests a common underlying magnetic reconnection process.