One of the biggest remaining mysteries of science is right inside our heads: How does nature wire up a high-performance computer without having a detailed blueprint specifying the location and strength of every connection? It is assumed that local connectivity in our cortex is random at first, and during development undergoes refinement until only the 'right' connections prevail. But how can the brain tell 'right' from 'wrong' connections? The majority of excitatory connections are formed on dendritic spines, tiny excrescences that cover almost the entire dendritic surface of most neurons. Since their discovery by Ramón y Cajal in 1896, neuroscientists have been fascinated by these structures, which ultimately determine which neurons in the brain become connected and form functional networks. Here we review the many important functions of spines and explain why electrical and biochemical processes in these tiny structures are thought to be crucial for the plasticity of the brain.