Caenorhabditis elegans shows chemotaxis to various odorants and water-soluble chemoattractants such as NaCl. Previous studies described the pirouette mechanism for chemotaxis, in which C. elegans quickly changes the direction of locomotion by using a set of stereotyped behaviors, a pirouette, in response to a decrease in the concentration of the chemical. Here, we report the discovery of a second mechanism for chemotaxis, called the weathervane mechanism. In this strategy animals respond to a spatial gradient of chemoattractant and gradually curve toward higher concentration of the chemical. By computer simulation, we find that both of these mechanisms contribute to chemotaxis and both mechanisms need to act in parallel for efficient chemotaxis. Using laser ablation of individual neurons to examine the underlying neural circuit, we find the ASE sensory neurons and AIZ interneurons are essential for both the pirouette and weathervane mechanisms in chemotaxis to NaCl. Salt-conditioned animals show reversed responses in both of these behaviors, leading to avoidance of NaCl. These results provide a platform for detailed molecular and cellular analyses of chemotaxis and its plasticity in this model organism.