We report a combined x-ray photon correlation spectroscopy and rheometry study of moderately concentrated suspensions of silica colloids that form a gel on cooling. During gel formation, the suspensions acquire a shear modulus that increases with time, while the thermal motion of the colloids becomes localized over an increasingly restricted range. The nanometer-scale localization length characterizing this motion obeys an exact relationship with the shear modulus predicted theoretically from mode coupling calculations [K. S. Schweizer and G. Yatsenko, J. Chem. Phys. 127, 164505 (2007)]. This scaling thus demonstrates a direct quantitative connection between the microscopic dynamics and macroscopic rheology. It further indicates the importance of local structure over longer-range correlations in dictating the dynamical and mechanical properties of such gels.