A spectrometer is an optical instrument used to measure properties of light over a specific portion of the electromagnetic spectrum.
The independent variable is usually the wavelength of the light. The variable measured is most often the light's intensity but could also, for instance, be the polarization state. A spectrometer is used in spectroscopy for producing spectral lines and measuring their wavelengths and intensities. Spectrometer is a term that is applied to instruments that operate over a very wide range of wavelengths, from gamma rays and X-rays into the far infrared.
In general, any particular instrument will operate over a small portion of this total range because of the different techniques used to measure different portions of the spectrum. Below optical frequencies (that is, at microwave, radio, and audio frequencies), the spectrum analyzer is a closely related electronic device.