A supernova is a massive explosion that occurs upon the death of an old star. When a massive star runs out of nuclear fuel, the star has no counteractive force against its own gravity and collapses. The resulting shock wave blows the outer layers of the star into space, possibly leaving a core that becomes either a neutron star or a black hole, depending on the remaining mass. A different kind of supernova occurs (more rarely in our Milky Way Galaxy) when a white dwarf star in a tight binary system swallows material from her companion, eventually becoming too massive and collapsing.
When stars explode, they emit an electrical magnetic pulse. This pulse can cause electro-magnetic devices such as computers to fail. An event of this kind took place in 2364 when a star in the Beta Magellan system supernovaed resulting in main computer failure on Bynaus. (TNG: "11001001")
In 2268, the crew of the USS Enterprise observed the supernova Beta Niobe and the destruction of planet Sarpeidon. A few weeks earlier, she had already witnessed the supernova Minara. (TOS: "The Empath", "All Our Yesterdays")
In 2366, the star Beta Stromgren exploded as a supernova. The last stages of the star's life were observed by the USS Enterprise-D while taking first contact with the creature Gomtuu. (TNG: "Tin Man")
Supernovae, however, generally occur only approximately twice per century in the Milky Way Galaxy. As of the 24th century, only three Starfleet vessels ever witnessed supernovae firsthand. The record for the closest observation was less than 10 billion kilometers and was set by the USS Voyager in 2373. (VOY: "The Q and the Grey")
In 2373, a number of supernovae occurred within a small region of the Delta Quadrant, as a result of the Q Civil War. These supernovae were actually the result of spatial disruptions within the Q Continuum.
The crew of Voyager, acting on information provided by the female Q, used the explosion of one of these supernovae to enter the Continuum themselves, in order to rescue Q and Captain Janeway. (VOY: "The Q and the Grey")
Several weeks later, in the Alpha Quadrant, the Changeling posing as Doctor Julian Bashir attempted to trigger a supernova in the Bajoran sun using trilithium, tekasite and protomatter. The Founder was stopped by Kira Nerys, Jadzia Dax and the crew of the USS Defiant. (DS9: "By Inferno's Light")
In 2387, a supernova threatened the galaxy. Ambassador Spock stopped the supernova by using red matter to create a black hole, which consumed the supernova. Before he could, however, the supernova destroyed Romulus. (Star Trek)