Using classical as well as ab initio molecular dynamics simulations, we calculate the frequency-dependent shear viscosity of pure water and water–glycerol mixtures. In agreement with recent experiments, we find deviations from Newtonian-fluid behavior in the THz regime. Based on an extension of the Maxwell model, we introduce a viscoelastic model to describe the observed viscosity spectrum of pure water. We find four relaxation modes in the spectrum which we attribute to (i) hydrogen–bond network topology changes, (ii) hydrogen–bond stretch vibrations of water pairs, (iii) collective vibrations of water molecule triplets, and (iv) librational excitations of individual water molecules. Our model quantitatively describes the viscoelastic response of liquid water on short timescales, where the hydrodynamic description via a Newtonian-fluid model breaks down.