Animal migrations track predictable seasonal patterns of resource availability and suitable thermal habitat. As climate change alters this energy landscape, some migratory species may struggle to adapt. We examined how climate variability influences movements, thermal habitat selection and energy intake by juvenile Pacific bluefin tuna (Thunnus orientalis) during seasonal foraging migrations in the California Current. We tracked 242 tuna across 15 years (2002-2016) with high-resolution archival tags, estimating their daily energy intake via abdominal warming associated with digestion (the heat increment of feeding). The poleward extent of foraging migrations was flexible in response to climate variability, allowing tuna to track poleward displacements of thermal habitat where their standard metabolic rates were minimized. During a marine heatwave that saw temperature anomalies of up to +2.5°C in the California Current, spatially explicit energy intake by tuna was approximately 15% lower than average. However, by shifting their mean seasonal migration approximately 900 km poleward, tuna remained in waters within their optimal temperature range and increased their energy intake. Our findings illustrate how tradeoffs between physiology and prey availability structure migration in a highly mobile vertebrate, and suggest that flexible migration strategies can buffer animals against energetic costs associated with climate variability and change.