Many observers have noted that the sea is full of loud sounds, both ongoing and episodic. Among the many sources of natural ambient noise are wave action, physical processes such as undersea earthquakes, and biological activities of shrimps, fish, dolphins and whales. Despite interest by acoustics experts, sound production by cephalopods has been reported only twice, both involving squid. The ‘faint poppings’ produced were thought to result from fluttering of the thin external lips of the squid's funnel while water is being expelled through it. Otherwise, no information is available on cephalopod sounds. Here we present a noise produced by a stressed common octopus. The event was filmed and recorded in the wild. The hypothesis we offer to explain how this sound was produced is cavitation, which has been documented in several biological systems. In our case, the water expelled through the funnel may have created a jet with a velocity so high that the turbulent pressure dropped locally below the vapour pressure of the water. Seawater contains gas microbubbles, which will grow in size when they are entrained in the region of low pressure. Subsequently, the bubbles collapse violently when pressure rises again. The sound produced by the octopus is like a gunshot, and distinct lights observed at the same time contradict the existence of a simple pressure wave and point to the possible presence of gas-bubbles, which would change the light intensity by reflection and refraction of the sunlight. This behaviour seems to be a defensive strategy to escape from vibration-sensitive predators.