Blazars can be detected from very large distances due to their high luminosity. However, the detection of γ-ray emission of blazars beyond z = 3 has only been confirmed for a small number of sources. Such observations probe the growth of supermassive black holes close to the peak of star formation in the history of galaxy evolution. As a result from a continuous monitoring of a sample of 80 z > 3 blazars with the Fermi Large Area Telescope (Fermi-LAT), we present the first detection of a γ-ray flare from the z = 4.31 blazar TXS 1508+572. This source showed high γ-ray activity from 2022 February to August, reaching a peak luminosity comparable to the most luminous flares ever detected with Fermi-LAT. We conducted a multiwavelength observing campaign involving XMM-Newton, the Neil Gehrels Swift Observatory, the Effelsberg 100 m radio telescope, and the Very Long Baseline Array. In addition, we make use of the monitoring programs by the Zwicky Transient Facility and the Near-Earth Object Wide-field Infrared Survey Explorer at optical and infrared wavelengths, respectively. We find that the source is particularly variable in the infrared band on daily timescales. The spectral energy distribution collected during our campaign is well described by a one-zone leptonic model, with the γ-ray flare originating from an increase of external Compton emission as a result of a fresh injection of accelerated electrons.