A new Lyapunov stability condition is formulated for the shallow-water equations, using a gauge-variable formalism. This sufficient condition is derived for the class of perturbations that conserve the total mass. It is weaker than existing stability criteria, i.e. it applies to a wider class of flows. Formal stability to infinitesimally small perturbations of arbitrary shape is obtained for two classes of large-scale geophysical flows: pseudo-eastward flow with constant shear, and localized coherent structures of modon type.