The trek through the city by sheep and shepherds follows the centuries-old tradition of transhumance, in which cattle migrate from summer to winter pastures, El Pais reported.
Jesus Garzon, president of a shepherds council established in 1273, said the sheep, along with 60 cattle, crossed the city to exercise their right along routes that go back to Madrid's days as a rural hamlet, The Daily Telegraph reported.
The shepherds have the right to use 78,000 miles of paths for seasonal livestock migrations from the cool highland pastures in summer to warmer locales for winter. About 1 million animals, mostly sheep and cattle, participate in Spain's transhumance.
The Telegraph said some of the paths have been used for more than 800 years, and two north-south routes go through Madrid, one dating to 1372.
For the past 18 years, shepherds have stopped traffic in Madrid for the annual ritual.