Caenorhabditis elegans uses a variety of attractive olfactory cues to detect food. We show here that the responses to olfactory cues are regulated in a dynamic way by behavioral context and the animal's previous experience. Prolonged exposure to an odorant leads to a decreased response to that odorant, a form of behavioral plasticity called olfactory adaptation. We show that starvation can increase the extent of olfactory adaptation to the odorant benzaldehyde; this effect of starvation persists for several hours after the animals have been returned to food. The effect of starvation is antagonized by exogenous serotonin, which induces many of the same behavioral responses in C. elegans as are induced by food. Starvation also inhibits recovery from adaptation to a different odorant, 2-methylpyrazine, thus enhancing olfactory memory. In addition to its effects on adaptation, starvation modulates olfactory discrimination in C. elegans; starved animals discriminate more classes of odorants than fed animals. Increased olfactory discrimination is also seen in the adaptation-defective mutant adp-1 (ky20). These various forms of behavioral plasticity enhance the ability of starved animals to respond to novel, potentially informative odorants.