Many free-ranging predators have to make foraging decisions with little, if any, knowledge of present resource distribution and availability. The optimal search strategy they should use to maximize encounter rates with prey in heterogeneous natural environments remains a largely unresolved issue in ecology. Lévy walks are specialized random walks giving rise to fractal movement trajectories that may represent an optimal solution for searching complex landscapes. However, the adaptive significance of this putative strategy in response to natural prey distributions remains untested. Here we analyse over a million movement displacements recorded from animal-attached electronic tags to show that diverse marine predators-sharks, bony fishes, sea turtles and penguins-exhibit Lévy-walk-like behaviour close to a theoretical optimum. Prey density distributions also display Lévy-like fractal patterns, suggesting response movements by predators to prey distributions. Simulations show that predators have higher encounter rates when adopting Lévy-type foraging in natural-like prey fields compared with purely random landscapes. This is consistent with the hypothesis that observed search patterns are adapted to observed statistical patterns of the landscape. This may explain why Lévy-like behaviour seems to be widespread among diverse organisms, from microbes to humans, as a 'rule' that evolved in response to patchy resource distributions.