Spin dynamics in the pseudogap state of a high-temperature superconductor