Ontogenetic changes in habitat and food preferences are common in nature; they reflect changes in the needs of organisms during their lifetime. Studying the dietary ontogeny of pelagic species is a difficult task, because of migratory processes and the inaccessibility of their habitats. As a result, their life history remains poorly understood, or even unknown. Here, we studied the dietary ontogeny of 18 blue sharks, Prionace glauca, using isotopic analysis in vertebrae. A total of 132 samples of vertebral collagen were taken (64 from males and 68 from females). The wide range of δ13C values (− 16.8 to − 13.1‰) suggests that these sharks use both coastal and oceanic areas for feeding. Small juveniles and adults preferred coastal areas, while medium-sized and large juveniles preferred oceanic areas. The estimated δ15N values (9.5–19.0‰) suggest that P. glauca is a top predator that occupies various trophic levels and/or it feeds across areas with different baseline δ15N (trophic position 3.9–8.4). Isotopic enrichment and differences in δ13C and δ15N thus suggest ontogenetic changes in habitat use and prey consumption between maturity stages. The use of hard anatomical structures (vertebrae) is highly relevant because they integrate information on the dietary ontogeny of this shark species.