Locating sound sources such as prey or predators is critical for survival in many vertebrates. Terrestrial vertebrates locate sources by measuring the time delay and intensity difference of sound pressure at each ear1–5. Underwater, however, the physics of sound makes interaural cues very small, suggesting that directional hearing in fish should be nearly impossible6. Yet, directional hearing has been confirmed behaviourally, although the mechanisms have remained unknown for decades. Several hypotheses have been proposed to explain this remarkable ability, including the possibility that fish evolved an extreme sensitivity to minute interaural differences or that fish might compare sound pressure with particle motion signals7,8. However, experimental challenges have long hindered a definitive explanation. Here we empirically test these models in the transparent teleost Danionella cerebrum, one of the smallest vertebrates9,10. By selectively controlling pressure and particle motion, we dissect the sensory algorithm underlying directional acoustic startles. We find that both cues are indispensable for this behaviour and that their relative phase controls its direction. Using micro-computed tomography and optical vibrometry, we further show that D. cerebrum has the sensory structures to implement this mechanism. D. cerebrum shares these structures with more than 15% of living vertebrate species, suggesting a widespread mechanism for inferring sound direction.