The ability to learn that a sensory stimulus signals a reward or punishment is one of the brain functions most critical for adaptation and survival. How animals integrate information about learnt sensory stimuli with spatial context and animal internal state is not completely understood. Here we developed a learning paradigm to evaluate the influence of spatial context on the association of an odor with a reward. Water-restricted mice were trained to perform an olfactory discrimination task under head-fixed conditions, whereby animals learn to drink water or not depending on the virtual visual context in which odor is presented. We show that animals reached to criterion within a few sessions. Learning was sequential, at first animals learn the position of the reward, then to discriminate between odors, and finally to discriminate between visual context, suggesting a difference in stimuli salience. We analyze three behavioral variables that change along learning: licking, sniffing and locomotion speed. Since an appropriate response to odor helps animals adapt to changing environments, we also studied how flexible is this behavior. We carried out a reversal learning protocol where the odor rewarded was changed, in the same context as before. Results showed that it took between 2-4 sessions to reverse the behavior. Therefore, we developed a behavioral paradigm suited to probing the neural basis of spatial context modulation of an olfactory-based behavior and its flexibility.