Although the first ten million years of whale evolution are documented by a remarkable series of fossil skeletons, the link to the ancestor of cetaceans has been missing. It was known that whales are related to even-toed ungulates (artiodactyls), but until now no artiodactyls were morphologically close to early whales. Here we show that the Eocene south Asian raoellid artiodactyls are the sister group to whales. The raoellid Indohyus is similar to whales, and unlike other artiodactyls, in the structure of its ears and premolars, in the density of its limb bones and in the stable-oxygen-isotope composition of its teeth. We also show that a major dietary change occurred during the transition from artiodactyls to whales and that raoellids were aquatic waders. This indicates that aquatic life in this lineage occurred before the origin of the order Cetacea.