Direct measurements of strain depth profiles in Ge layers consisting of either pyramidal or dome-shaped nanostructures grown on Si(001) by gas-source molecular-beam epitaxy were obtained using medium-energy ion scattering spectroscopy. Layers consisting solely of pyramidal Ge structures (corresponding to total Ge coverages θGe=5.5 ML) exhibit a compressive strain of 2.1% which is uniform with depth. In contrast, Ge layers with a dome-shaped surface morphology (θGe=8.9 ML) undergo significant relaxation giving rise to a strain gradient which varies from 0.6% at the surface to 2.1% at the Ge/Si(001) interface.