The contraction of matter in the primordial medium, to form the first gravitationally bound structures, was mediated by radiative cooling of the gas by H-2 and HD. We have computed the initial phases of free-fall collapse, incorporating the results of quantum mechanical calculations of rate coefficients for collisional excitation of H-2 and HD by the principal perturbers, H, He, H-2 and H+. The structure of shock waves produced when the collapse speed exceeds the local sound speed is determined. In the post-shock gas, radiative cooling by H-2 exceeds that by HD, but by a factor of only 4. The intensities of the strongest emission lines of H-2 - rotational transitions within the vibrational ground state - are calculated. Even with coarse spectral and angular resolution, these transitions might be observable as inhomogeneities in the cosmic background radiation.