The brain's anatomy constrains its function, but precisely how remains unclear. Here, we show that human cortical and subcortical activity, measured with magnetic resonance imaging under spontaneous and diverse task-evoked conditions, can be parsimoniously understood as resulting from excitations of fundamental, resonant modes of the brain's geometry (i.e., its shape) rather than of its complex inter-regional connectivity, as classically assumed. We then use these modes to show that task-evoked activations across >10,000 brain maps are not confined to focal areas, as widely believed, but instead excite brain-wide modes with wavelengths spanning >60 mm. Finally, we confirm theoretical predictions that the close link between geometry and function is explained by a dominant role for wave-like dynamics, showing that such dynamics can reproduce numerous canonical spatiotemporal properties of spontaneous and evoked recordings. Our findings challenge prevailing views of brain function and identify a previously under-appreciated role of brain geometry that is predicted by a unifying and physically principled approach.