Understanding the interplay among the external environment, physiology and adaptive behaviour is crucial for understanding how animals survive in their natural environments. The external environment can have wide ranging effects on the physiology of animals, while behaviour determines which environments are encountered. Here, we identified changes in the behavioural selection of external salinity in Fundulus heteroclitus, an estuarine teleost, as a consequence of digesting a meal. Fish that consumed high levels of dietary calcium exhibited a higher preferred salinity compared with unfed fish, an effect that was exaggerated by elevated dietary sodium chloride. The mean swimming speed (calculated as a proxy of activity level) was not affected by consuming a diet of any type. Constraining fish to water of 22 p.p.t. salinity during the digestion of a meal did not alter the amount of calcium that was absorbed across the intestine. However, when denied the capacity to increase their surrounding salinity, the compromised ability to excrete calcium to the water resulted in significantly elevated plasma calcium levels, a potentially hazardous physiological consequence. This study is the first to show that fish behaviourally exploit their surroundings to enhance their ionoregulation during digestion, and to pinpoint the novel role of dietary calcium and sodium in shaping this behaviour. We conclude that in order to resolve physiological disturbances in ion balance created by digestion, fish actively sense and select the environment they inhabit. Ultimately, this may result in transient diet-dependent alteration of the ecological niches occupied by fishes, with broad implications for both physiology and ecology.