Precise quantification of extracellular glutamate concentrations upon neuronal activation is crucial for the understanding of brain function and neurological disorders. While optogenetics is an outstanding method for the correlation between distinct neurons and their role in circuitry and behavior, the electrochemically inactive nature of glutamate has proven challenging for recording upon optogenetic stimulations. This difficulty is due to the necessity for using enzyme-coated microelectrodes and the risk for light-induced artifacts. In this study, we establish a method for the combination of in vivo optogenetic stimulation with selective measurement of glutamate concentrations using enzyme-coated multielectrode arrays and amperometry. The glutamatergic subthalamic nucleus (STN), which is the main electrode target site in deep brain stimulation treatment of advanced Parkinson's disease, has recently proven opotogenetically targetable in Pitx2-Cre-transgenic mice and was here used as model system. Upon stereotactic injection of viral Channelrhodopsin2-eYFP constructs into the STN, amperometric recordings were performed at a range of optogenetic stimulation frequencies in the globus pallidus, the main STN target area, in anesthetized mice. Accurate quantification was enabled through a multi-step analysis approach based on self-referencing microelectrodes and repetition of the experimental protocol at two holding potentials, which allowed for the identification, isolation and removal of photoelectric and photoelectrochemical artifacts. This study advances the field of in vivo glutamate detection with combined optogenetics and amperometric recordings by providing a validated analysis framework for application in a wide variety of glutamate-based approaches in neuroscience.