Starfleet vessels contain a lot of advanced technology and sensitive data. To prevent any of it from falling into enemy hands, all Starfleet vessels are equipped with auto-destruct systems. The auto-destruct system is designed to function even if the main computer and most other systems are disabled or destroyed.
The primary auto-destruct system involved releasing all safety interlocks on the warp engine system and expelling the matter anti-matter simultaneously. The resulting explosion is roughly equivalent to 1,000 Type II photon torpedoes. The secondary system (the primary system for some separated saucer modules or other types of modules) is used when command links are severed. It involves ordinance packages (places in strategic locations throughout the ship) and an overload of the fusion reactors. It causes an explosion roughly the same as 500 Type II photon torpedoes. Either explosion is sufficient to destroy the ship and all of its key systems completely, kill everyone aboard, and deny an enemy any useful technology or data.
Activating the auto-destruct system requires verbal commands from both the captain and the executive officer (unless the computer acknowledges one of them is dead). After the computer confirms the executive officers order and the captain informs it of the desired interval until destruction, the computer begins a verbal and visual countdown. The captain or executive officer can abort the destruct sequence at any time with a voice command.