Old English spura, spora "metal implement worn on the heel to goad a horse" (related to spurnan "to kick"), from Proto-Germanic *spuron (source also of Old Norse spori, Middle Dutch spore, Dutch spoor, Old High German sporo, German Sporn "spur"), from PIE *spere- "ankle" (see spurn). Related to Dutch spoor, Old English spor "track, footprint, trace."
Generalized sense of "anything that urges on, stimulus," is from late 14c. As a sharp projection on the leg of a cock, from 1540s. Meaning "a ridge projecting off a mountain mass" is recorded from 1650s. Of railway lines from 1837. "Widely extended senses ... are characteristic of a horsey race" [Weekley]. Expression on the spur of the moment (1801) preserves archaic phrase on the spur "in great haste" (1520s). To win one's spurs is to gain knighthood by some valorous act, gilded spurs being the distinctive mark of a knight.
c. 1200, from spur (n.). Figurative use from c. 1500. Related: Spurred; spurring. Old English had spyrian, but it meant "follow the track of, track down, investigate."