The ability to encode and transmit a signal is an essential property that must demonstrate many neuronal circuits in sensory areas in addition to any processing they may provide. It is known that an appropriate level of lateral inhibition, as observed in these areas, can significantly improve the encoding ability of a population of neurons. We show here a homeostatic mechanism by which a spike-timing-dependent plasticity (STDP) rule with a symmetric timing window (swSTDP) spontaneously drives the inhibitory coupling to a level that ensures accurate encoding in response to input signals within a certain frequency range. Interpreting these results mathematically, we find that this coupling level depends on the overlap of spectral information between stimulus and STDP window function. Generalization to arbitrary swSTDP and arbitrary stimuli reveals that the signals for which this improvement of encoding takes place can be finely selected on spectral criteria. We finally show that this spectral overlap principle holds for a variety of neuron types and network characteristics. The highly tunable frequency-power domain of efficiency of this mechanism, together with its ability to operate in very various neuronal contexts, suggest that it may be at work in most sensory areas.