The properties of water at the nanoscale are crucial in many areas of biology, but the confinement of water molecules in sub-nanometre channels in biological systems has received relatively little attention. Advances in nanotechnology make it possible to explore the role played by water molecules in living systems, potentially leading to the development of ultrasensitive biosensors. Here we show that the adsorption of water by a self-assembled monolayer of single-stranded DNA on a silicon microcantilever can be detected by measuring how the tension in the monolayer changes as a result of hydration. Our approach relies on the microcantilever bending by an amount that depends on the tension in the monolayer. In particular, we find that the tension changes dramatically when the monolayer interacts with either complementary or single mismatched single-stranded DNA targets. Our results suggest that the tension is mainly governed by hydration forces in the channels between the DNA molecules and could lead to the development of a label-free DNA biosensor that can detect single mutations. The technique provides sensitivity in the femtomolar range that is at least two orders of magnitude better than that obtained previously with label-free nanomechanical biosensors and with label-dependent microarrays.