The spectral fluctuations of quantum (or wave) systems with a chaotic classical (or ray) limit are mostly universal and faithful to random-matrix theory. Taking up ideas of Pechukas and Yukawa we show that equilibrium statistical mechanics for the fictitious gas of particles associated with the parametric motion of levels yields spectral fluctuations of the random-matrix type. Previously known clues to that goal are an appropriate equilibrium ensemble and a certain ergodicity of level dynamics. We here complete the reasoning by establishing a power law for the $hbar$ dependence of the mean parametric separation of avoided level crossings. Due to that law universal spectral fluctuations emerge as average behavior of a family of quantum dynamics drawn from a control parameter interval which becomes vanishingly small in the classical limit; the family thus corresponds to a single classical system. We also argue that classically integrable dynamics cannot produce universal spectral fluctuations since their level dynamics resembles a nearly ideal Pechukas-Yukawa gas.