A flaring X-ray source was found near the galaxy NGC 4697 (ref. 1). Two brief flares were seen, separated by four years. During each flare, the flux increased by a factor of 90 on a timescale of about one minute. There is no associated optical source at the position of the flares, but if the source was at the distance of NGC 4697, then the luminosities of the flares were greater than 1039 erg per second. Here we report the results of a search of archival X-ray data for 70 nearby galaxies looking for similar flares. We found two ultraluminous flaring sources in globular clusters or ultracompact dwarf companions of parent elliptical galaxies. One source flared once to a peak luminosity of 9 × 1040 erg per second; the other flared five times to 1040 erg per second. The rise times of all of the flares were less than one minute, and the flares then decayed over about an hour. When not flaring, the sources appear to be normal accreting neutron-star or black-hole X-ray binaries, but they are located in old stellar populations, unlike the magnetars, anomalous X-ray pulsars or soft γ repeaters that have repetitive flares of similar luminosities.