Sperm whales are the only whales known to rest in an upright position.
Scientists think this helps them avoid being disturbed by waves at the surface while also saving energy compared with staying deep underwater.
However, until now, experts were unsure how the whales managed to stay in the same spot while they rested.
The new discovery was made by an international team of researchers from the University of St Andrew’s in Scotland and the Université de Neuchâtel in Switzerland.
The team used special tags attached to sperm whales, which recorded the animals’ movements and sounds as they rested in the sea near the coast of Norway.