The auto-destruct system (also called self-destruct or destruct sequence) is a starship system to purposefully destroy the vessel. It is usually a tactic of last resort to prevent the ship and its contents from falling into enemy hands.
The first mechanism, used by Starfleet, as well as Klingons, was to deliberately create a warp core breach. The second mechanism was also in use in Starfleet but was favored by the Hydrans: placing charges at strategic locations on the ship. (RIS Bouteina: "Vosteage")
In all cases, self-destruct sequences could be aborted up to 5 seconds before the auto-destruct sequence went off. Some ships required only the captain's clearance but other ships needed the clearance of the commanding officer, the first officer and the second officer.
In 2372, a mutiny aboard the HMS Vosteage over the legality of the Hydran cloaking device experiment supposedly led to the auto-destruction of the Vosteage. However, this was proven to be untrue because the proximity fuses were faulty. (RIS Bouteina: "Vosteage")
Captain Roger Osmont detonated the USS Carpathia's self-destruct when he rammed a Jem'Hadar carrier. The resulting explosion destroyed both ships and several other vessels nearby. (LUG RPG: The Dominion War Sourcebook: The Fires of Armageddon)
In 2381, Captain Jonathan Hunt armed the USS Beliskner's auto-destruct sequence, with the intent to ram the USS Excalibur. In this instance, he chose to set the warp core to detonate on impact with the enemy vessel. fortunately, with the timely arrival of the USS Seahawk, this action proved unnecessary. (Star Trek: New Order: Deus Ex Machina)
In 2410, Captain Jojo Appiah self-destructed Starbase 234 to prevent the invading Heralds from gaining access to the computers. His last words were to Captain Kanril Eleya over subspace radio. (Bait and Switch: Beat the Drums of War)