Food and water are rewarding in part because they satisfy our internal needs. Dopaminergic neurons in the ventral tegmental area (VTA) are activated by gustatory rewards, but how animals learn to associate these oral cues with the delayed physiological effects of ingestion is unknown. Here we show that individual dopaminergic neurons in the VTA respond to detection of nutrients or water at specific stages of ingestion. A major subset of dopaminergic neurons tracks changes in systemic hydration that occur tens of minutes after thirsty mice drink water, whereas different dopaminergic neurons respond to nutrients in the gastrointestinal tract. We show that information about fluid balance is transmitted to the VTA by a hypothalamic pathway and then re-routed to downstream circuits that track the oral, gastrointestinal and post-absorptive stages of ingestion. To investigate the function of these signals, we used a paradigm in which a fluid’s oral and post-absorptive effects can be independently manipulated and temporally separated. We show that mice rapidly learn to prefer one fluid over another based solely on its rehydrating ability and that this post-ingestive learning is prevented if dopaminergic neurons in the VTA are selectively silenced after consumption. These findings reveal that the midbrain dopamine system contains subsystems that track different modalities and stages of ingestion, on timescales from seconds to tens of minutes, and that this information is used to drive learning about the consequences of ingestion.