Fossils show early whales became agile swimmers in a mere blink of evolution - about 10 million years.
Scientists believe the ancestors of whales were land animals that crawled into the sea to escape predators or seek food.
The mammals gradually lost their limbs and became fully adapted to living in the ocean.
According to new evidence, published in the journal Nature, one of the secrets to adapting to a marine environment was a scaled-down inner ear.
This semi-circular canal system gives land mammals, including humans, a sense of balance.
We only become aware of its role when something goes awry - such as feeling drunk, sea sick or riding a rollercoaster.
Animal acrobats
Modern whales, dolphins and porpoises (cetaceans) have similar inner ears to land mammals.
These are smaller, size-for-size, than land-dwellers. Our inner ears, for example, are bigger than those of the blue whale.
However, unlike say a large elephant, a whale can make acrobatic leaps and turns without experiencing vertigo.
This is thought to be because its smaller inner ear is less sensitive.
Fossils show that the inner ear of early whales evolved rapidly after they entered the sea. The adaptation enabled early whales to swim without becoming dizzy.
Marine diversity
Primitive whales probably became fully aquatic about 5-10 million years after they took to the sea about 50 million years ago.
It may sound like a long time but it is remarkably quick in evolutionary terms.
Rich Lane, director of the US National Science Foundation's palaeontology programme, which funded the research, said: "The early evolutionary development of small semicircular canals by cetaceans opened an entirely new mammalian niche for habitation and contributed to the broad diversity of marine living habits that we see in whales today."
He said the evolutionary acquisition of such specialised organs or abilities - like the brain and upright walking habit of man - provided mechanisms by which highly evolved organisms dominated in certain environments.
In short, it explains how whales came to rule the oceans.