Water, the most abundant volatile in Earth's interior, preserves the young surface of our planet by catalysing mantle convection, lubricating plate tectonics and feeding arc volcanism. Since planetary accretion, water has been exchanged between the hydrosphere and the geosphere, but its depth distribution in the mantle remains elusive. Water drastically reduces the strength of olivine1and this effect can be exploited to estimate the water content of olivine from the mechanical response of the asthenosphere to stress perturbations such as the ones following large earthquakes. Here, we exploit the sensitivity to water of the strength of olivine2, the weakest and most abundant mineral in the upper mantle, and observations of the exceptionally large (moment magnitude 8.6) 2012 Indian Ocean earthquake3to constrain the stratification of water content in the upper mantle. Taking into account a wide range of temperature conditions and the transient creep of olivine, we explain the transient deformation in the aftermath of the earthquake that was recorded by continuous geodetic stations along Sumatra as the result of water- and stress-activated creep of olivine. This implies a minimum water content of about 0.01 per cent by weight—or 1,600 H atoms per million Si atoms—in the asthenosphere (the part of the upper mantle below the lithosphere). The earthquake ruptured conjugate faults down to great depths4, compatible with dry olivine in the oceanic lithosphere. We attribute the steep rheological contrast to dehydration across the lithosphere-asthenosphere boundary, presumably by buoyant melt migration to form the oceanic crust.