Spanning Tree Protocol is used to prevent layer-2 loops which would cause broadcast storms in a LAN.
The developer of Spanning Tree was Dr. Radioa Perlman of Sun. He wrote a poem about the spanning tree idea, here it is:
"Algorhyme" by Dr. Radia Perlman[edit]
I think that I shall never see A graph more lovely than a tree. A tree whose crucial property Is loop-free connectivity. A tree which must be sure to span. So packets can reach every LAN. First the Root must be selected By ID it is elected. Least cost paths from Root are traced In the tree these paths are placed. A mesh is made by folks like me Then bridges find a spanning tree.
(*) based on Joyce Kilmer's "Trees"