How do NASA's Curiosity determine the elemental composition of Mars using spectrometer? From this article on hindustantimes.com - Curiosity sends data about Martian surface:

The resultant flash of glowing plasma is viewed by the system’s 4.3-inch aperture telescope, which sends the light down an optical fiber to a spectrometer located in the body of the rover. There, the colours of light from the flash are recorded and then sent to Earth, enabling scientists to determine the elemental composition of the vaporized material.

How do NASA's Curiosity determine the elemental composition of Mars using spectrometer? Do just examining the colors of light enabled scientist to determine the elemental composition of any object?
 A: Yes, with a few tricks of course. 
Put very simply: when you let white light pass through a gas and examine the light afterwards, you'll find that all sorts of colours are "missing" from the light. Precisely which colours are missing depends for the most part on the exact constituents of the gas. 
It also works the other way around: if you heat the gas up to the point where it starts emitting light, this light will not be perfectly white, but consist mostly of the colours that were missing before. 
Have a read about Fraunhofer lines, and spectroscopy for a general overview. Then, for more background about spectroscopic instruments, read up on prisms for a nice introduction, and diffraction gratings for a few examples of more advanced techniques.
A: Yes, the response can be analysed to detect the tiny differences between wavelengths - which is used to identify atoms:
From the Encyclopedia Britannica,

Spectroscopic techniques are extremely sensitive. Single atoms and even different isotopes of the same atom can be detected among 1020 or more atoms of a different species. (Isotopes are all atoms of an element that have unequal mass but the same atomic number. Isotopes of the same element are virtually identical chemically.) Trace amounts of pollutants or contaminants are often detected most effectively by spectroscopic techniques. Certain types of microwave, optical, and gamma-ray spectroscopy are capable of measuring infinitesimal frequency shifts in narrow spectroscopic lines. Frequency shifts as small as one part in 1015 of the frequency being measured can be observed with ultrahigh resolution laser techniques. Because of this sensitivity, the most accurate physical measurements have been frequency measurements.

A: This is a sample image provided by NASA... 

The Chemistry & Camera instrument (ChemCam) in Curiosity uses a laser to generate a flash of ionized plasma on the target sample (like Rock) & observes it with spectrometers receiving light through a telescope. Peaks in the intensity of light emitted at specific wavelengths are indicators of specific chemical elements in the target. The horizontal scale is wavelengths, in nanometers and the vertical scale is the Intensity.
The main advantage of spectrometers is that we could find different elements present on a sample in more efficient way. Every element has its own emission and absorption spectra. In case of hot bodies, the spectra would be continuous. In case of atoms in gaseous state (such as $Na$ or $Hg$ vapor), it would be line spectrum. In case of molecules, it would be band spectrum. Even Wikipedia has a good article on Emission and Absorption spectra. To go even in brief, refer Fraunhofer Lines. It would explain the absorption spectra obtained from sun - which was helpful to discover various elements present in sun's atmosphere by comparing the absorption spectra of elements here.
