The spike-timing-dependent plasticity (STDP), a synaptic learning rule for encoding learning and memory, relies on relative timing of neuronal activity on either side of the synapse. GABAergic signaling has been shown to control neuronal excitability and consequently the spike timing, but whether GABAergic circuits rule the STDP remained unknown. Here we show that GABAergic signaling governs the polarity of STDP, because blockade of GABAA receptors was able to completely reverse the temporal order of plasticity at corticostriatal synapses in rats and mice. GABA controls the polarity of STDP in both striatopallidal and striatonigral output neurons. Biophysical simulations and experimental investigations suggest that GABA controls STDP polarity through depolarizing effects at distal dendrites of striatal output neurons by modifying the balance of two calcium sources, NMDARs and voltage-sensitive calcium channels. These findings establish a central role for GABAergic circuits in shaping STDP and suggest that GABA could operate as a Hebbian/anti-Hebbian switch.