Water is a requirement for life as we know it. Indirect evidence of transient liquid water has been observed from orbiter on equatorial Mars, in contrast with expectations from large-scale climate models. The presence of perchlorate salts, which have been detected at Gale crater on equatorial Mars by the Curiosity rover, lowers the freezing temperature of water. Moreover, perchlorates can form stable hydrated compounds and liquid solutions by absorbing atmospheric water vapour through deliquescence. Here we analyse relative humidity, air temperature and ground temperature data from the Curiosity rover at Gale crater and find that the observations support the formation of night- time transient liquid brines in the uppermost 5 cm of the subsurface that then evaporate after sunrise. We also find that changes in the hydration state of salts within the uppermost 15 cm of the subsurface, as measured by Curiosity, are consistent with an active exchange of water at the atmosphere-soil interface. However, the water activity and temperature are probably too low to support terrestrial organisms. Perchlorates are widespread on the surface of Mars and we expect that liquid brines are abundant beyond equatorial regions where atmospheric humidity is higher and temperatures are lower.