Fast radio bursts are bright, millisecond-scale radio flashes of yet unknown physical origin. Recently, their extragalactic nature has been demonstrated and an increasing number of the sources have been found to repeat. 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. Here we report the detection with the Konus-Wind of a hard X-ray event of April 28, 2020, temporarily coincident with a bright, two-peak radio burst from the Galactic magnetar SGR~1935+2154 with properties remarkably similar to those of fast radio bursts. We show that two peaks of the double-peaked X-ray burst coincide in time with 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 an unusual hardness of its energy spectrum strongly distinguish the April 28 event among multiple ordinary flares detected from SGR~1935+2154 previously. This, and a recent non-detection of radio emission from about one hundred typical soft bursts from SGR 1935+2154 favors the idea that bright, FRB-like magnetar signals are associated with rare, hard-spectrum X-ray bursts, which implied rate ($sim$ 0.04 yr$^{-1}$ magnetar$^{-1}$) appears consistent with the rate estimate of SGR 1935+2154-like radio bursts (0.007 - 0.04 yr$^{-1}$ magnetar$^{-1}$).