In the case of the spontaneous boiling, the water has been superheated, which means that the water has been heated above its normal boiling point. How is that possible? Well, normally there are impuities in the water (like minerals or salt) and scratches on the surface of the cup which make it easier for bubbles to form. They do this by providing a phsical edge where bubbles can esailty br created, called nucleation sites. If there are neucleation sites, that as soon as a small portion of the water gets above the boiling poit, the water begins to boil in that region. On the other hand, if the water is very pure and the surface of the cup is very smooth, then there are no easy places for the bubbles to form, thus allowing the water to get to higher temperatures without boiling. When a spoon (or sugar) is put into this superheated water, the spoon provides the needed nucleation sites and the water, already above the boiling point, all boils away very very quickly. The exact same phenomenon occurs with supercooled liquids, except there the nucleation sites make it easier for ice crystals to form rather than bubbles.
The same phenomena is responsible for the popular Mentos and Diet Coke experiment. In this case, the soda is a supersaturated solution of carbon dioxide in water. The porous surface of the Mentos provide a huge number of nucleation sites for the release of carbon dioxide dissolved in the soda, causing it to spew out the top of the bottle.