Herring (Clupea harengus) enter and remain within North Sea estuaries during well-defined periods of their early life history. The costs and benefits of the migrations between offshore spawning grounds and upper, low-salinity zones of estuarine nurseries are identified using a dynamic state-variable model, in which the fitness of an individual is maximized by selecting the most profitable habitat. Spatio-temporal gradients in temperature, turbidity, food availability and predation risk simulate the environment. We modeled predation as a function of temperature, the optical properties of the ambient water, the time allocation of feeding and the abundance of whiting (Merlangius merlangus). Growth and metabolic costs were assessed using a bioenergetic model. Model runs using real input data for the Scheldt estuary (Belgium, The Netherlands) and the southern North Sea show that estuarine residence results in fitter individuals through a considerable increase in survival probability of age-0 fish. Young herring pay for their migration into safer estuarine water by foregoing growth opportunities at sea. We suggest that temperature and, in particular, the time lag between estuarine and seawater temperatures, acts as a basic cue for herring to navigate in the heterogeneous space between the offshore spawning grounds at sea and the oligohaline nursery zone in estuaries.