STP prevents switching loops by disabling redundant paths — electing a root bridge and blocking non-optimal paths. RSTP (Rapid STP) converges much faster than legacy STP.
Without STP, switching loops cause broadcast storms that take down networks. Root bridge election: lowest bridge ID (priority + MAC). BPDUGuard shuts down ports that receive BPDUs (prevents rogue switch attacks). Enable PortFast on edge ports for faster client connections.