Mass Spectrometry Introduction
Broadly speaking, mass spectrometry is a technique for measuring the mass/charge ratio of ions. Thus, provided that you can create an ion of a molecule (and there are lots of methods for doing this), you can determine its mass. Furthermore, once you have created an ion, you can fragment it (by colliding it at high velocity into a nitrogen molecule, for example) and measure the masses of the fragments. If you understand something about how your compound class breaks up, you can generally get a pretty good idea about the structure of the original molecule. As with all scientific techniques, however, the devil is in the details.
Prof. Suizdak has developed a very nice “History of Mass Spectrometry” site that I would recommend.