Mergers of neutron stars are known to be associated with short γ-ray bursts1-4. If the neutron-star equation of state is sufficiently stiff (that is, the pressure increases sharply as the density increases), at least some such mergers will leave behind a supramassive or even a stable neutron star that spins rapidly with a strong magnetic field5-8 (that is, a magnetar). Such a magnetar signature may have been observed in the form of the X-ray plateau that follows up to half of observed short γ-ray bursts9,10. However, it has been expected that some X-ray transients powered by binary neutron-star mergers may not be associated with a short γ-ray burst11,12. A fast X-ray transient (CDF-S XT1) was recently found to be associated with a faint host galaxy, the redshift of which is unknown13. Its X-ray and host-galaxy properties allow several possible explanations including a short γ-ray burst seen off-axis, a low-luminosity γ-ray burst at high redshift, or a tidal disruption event involving an intermediate-mass black hole and a white dwarf13. Here we report a second X-ray transient, CDF-S XT2, that is associated with a galaxy at redshift z = 0.738 (ref. 14). The measured light curve is fully consistent with the X-ray transient being powered by a millisecond magnetar. More intriguingly, CDF-S XT2 lies in the outskirts of its star-forming host galaxy with a moderate offset from the galaxy centre, as short γ-ray bursts often do15,16. The estimated event-rate density of similar X-ray transients, when corrected to the local value, is consistent with the event-rate density of binary neutron-star mergers that is robustly inferred from the detection of the gravitational-wave event GW170817.