The Spanning Tree Protocol (STP) algorithm prevents loops in switched networks with redundant paths. It does this by blocking certain ports to create a loop-free logical topology while maintaining redundancy for failover. STP does not propagate VLANs, restrict broadcasts, or segment broadcast domains.