How does the nervous system encode environmental stimuli as sensory experiences? Both the type (visual, olfactory, gustatory, mechanical or auditory) and the quality of a stimulus (spatial position, intensity or frequency) are represented as a neural code. Here we undertake a genetic analysis of sensory modality coding in Caenorhabditis elegans. The ASH sensory neurons respond to two distinct sensory stimuli (nose touch and osmotic stimuli). A mutation in the glr-1 (glutamate receptor) gene eliminates the response to nose touch but not to osmotic repellents. The predicted GLR-1 protein is roughly 40% identical to mammalian AMPA-class glutamate receptor (GluR) subunits. Analysis of glr-1 expression and genetic mosaics indicates that GLR-1 receptors act in synaptic targets of the ASH neurons. We propose that discrimination between the ASH sensory modalities arises from differential release of ASH neurotransmitters in response to different stimuli.