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 a GO/NO GO discrimination task in which the animal learns to drink water or not depending on the visual context in which the odor is presented. In head-fixed conditions, animals arrive to different spatial contexts by running in a virtual reality environment. We show that animals reached to criterion within a few sessions. Linking response, locomotion speed and inhalation rate changes throughout the learning process, the last two depending on trial types. Mice learnt to discriminate odors faster than visual contexts, suggesting a difference in stimuli salience. Since appropriate response to odor help animals to adapt 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. We developed an odor-in-context task suited to probing the neural basis of spatial context modulation of an olfactory-based behavior and its flexibility.