  The contemporaneous detection of gravitational waves and gamma rays from the
GW170817/GRB 170817A, followed by kilonova emission a day after, confirmed
compact binary neutron-star mergers as progenitors of short-duration gamma-ray
bursts (GRBs), and cosmic sources of heavy r-process nuclei. However, the
nature (and lifespan) of the merger remnant and the energy reservoir powering
these bright gamma-ray flashes remains debated, while the first minutes after
the merger are unexplored at optical wavelengths. Here, we report the earliest
discovery of bright thermal optical emission associated with the short GRB
180618A with extended gamma-ray emission, with ultraviolet and optical
multicolour observations starting as soon as 1.4 minutes post-burst. The
spectrum is consistent with a fast-fading afterglow and emerging thermal
optical emission at 15 minutes post-burst, which fades abruptly and
chromatically (flux density $F_{\nu} \propto t^{-\alpha}$, $\alpha=4.6 \pm
0.3$) just 35 minutes after the GRB. Our observations from gamma rays to
optical wavelengths are consistent with a hot nebula expanding at relativistic
speeds, powered by the plasma winds from a newborn, rapidly-spinning and highly
magnetized neutron star (i.e. a millisecond magnetar), whose rotational energy
is released at a rate $L_{\rm th} \propto t^{-(2.22\pm 0.14)}$ to reheat the
unbound merger-remnant material. These results suggest such neutron stars can
survive the collapse to a black hole on timescales much larger than a few
hundred milliseconds after the merger, and power the GRB itself through
accretion. Bright thermal optical counterparts to binary merger gravitational
wave sources may be common in future wide-field fast-cadence sky surveys.
