Fast radio bursts are bright, millisecond-scale radio flashes of yet unknown physical origin 1 .Recently, their extragalactic nature has been demonstrated 2, 3 , and an increasing number of the sources have been found to repeat 4 . Young, highly magnetized, isolated neutron stars -magnetars -have been suggested as the most promising candidates for fast radio burst progenitors owing to their energetics and high X-ray flaring activity 5, 6 . Here we report the detection with the Konus-Wind detector of a hard X-ray event of April 28, 2020, temporarily coincident with a bright, two-peak radio burst 7, 8 with properties remarkably similar to those of fast radio bursts. The source of the radio burst is located 7 in the direction to the Galactic magnetar SGR 1935+2154, which recently entered an active state. We show that a separation between two peaks of the double-peaked X-ray burst is nearly the same as that of the radio peaks, confirming that the X-ray and radio emission most likely have a common origin. Thus, this is the first simultaneous detection of a fast radio burst from a Galactic magnetar and its high-energy counterpart.The total energy emitted in X-rays in this burst is typical of bright short magnetar bursts, but its spiky light curve and an unusual hardness of the energy spectrum distinguish the April 28 event among multiple 'ordinary' flares detected from SGR 1935+2154 previously. This, and a recent non-detection 9 of radio emission from two typical bright soft bursts 10 from the same magnetar, may imply the existence of a special class of magnetar flares capable of producing fast radio bursts.