Context. The structural scaling relations (SSRs) of galaxies, that is, the observed correlations between effective radius, effective surface intensity, and velocity dispersion, are important tools for understanding how evolution proceeds. Aims. In this paper, we aim to demonstrate that the evolution of the SSRs back in time is governed by a combination of virial theorem (VT) and the relation L = L0′(t)σβ(t), where the parameters β and L0′ vary with time and from galaxy to galaxy. Methods. Using the WINGS database for the galaxies at redshift z = 0 and the Illustris-1 and IllustrisTNG databases of artificial galaxies, for the galaxies up to redshift z = 4, we analyse the SSRs back in time and, by means of simple algebraic expressions for L0′ and β (functions of time and other physical quantities), we derive the expected paths followed by galaxies in the various SSRs toward the distributions observed at z = 0. Results. The distribution of galaxies in the SSRs is ultimately related to the evolution in luminosity and velocity dispersion, which are empirically mirrored by the L = L0′(t)σβ(t) law. Furthermore, the β parameter works as a thermometer of the virialization of a galaxy. This parameter can assume either positive or negative values, and its absolute value attains high values when the galaxy is close to the virial condition, while it tends to zero when the galaxy is far from this condition. Conclusions. As the SSRs change with time, the method proposed in this paper allows us to decipher the temporal evolution of galaxies.