Acoustic cavitation-the formation and implosive collapse of bubbles-occurs when a liquid is exposed to intense sound. Cavitation can produce white noise, sonochemical reactions, erosion of hard materials, rupture of living cells and the emission of light, or sonoluminescence(1,2). The concentration of energy during the collapse is enormous: the energy of an emitted photon can exceed the energy density of the sound field by about twelve orders of magnitude(3), and it has long been predicted that the interior bubble temperature reaches thousands of degrees Kelvin during collapse, But experimental measurements(4,5) of conditions inside cavitating bubbles are scarce, and there have been no studies of interior temperature as a function of experimental parameters. Here we use multi-bubble sonoluminescence from excited states of metal atoms as a spectroscopic probe of temperatures inside cavitating bubbles. The intense atomic emission allows us to change the properties of the gas-vapour mixture within the bubble, and thus vary the effective emission temperature for multi-bubble sonoluminescence from 5,100 to 2,300 K. We observe emission temperatures that are in accord with those expected from compressional heating during cavitation.