The need for both high electrical conductivity and low thermal conductivity creates a design conflict for thermoelectric systems, leading to the consideration of materials with complicated crystal structures. Rattling of ions in cages results in low thermal conductivity, but understanding the mechanism through studies of the phonon dispersion using momentum-resolved spectroscopy is made difficult by the complexity of the unit cells. We have performed inelastic X-ray and neutron scattering experiments that are in remarkable agreement with our first-principles density-functional calculations of the phonon dispersion for thermoelectric Na0.8CoO2, which has a large-period superstructure. We have directly observed an Einstein-like rattling mode at low energy, involving large anharmonic displacements of the sodium ions inside multi-vacancy clusters. These rattling modes suppress the thermal conductivity by a factor of six compared with vacancy-free NaCoO2. Our results will guide the design of the next generation of materials for applications in solid-state refrigerators and power recovery.