Locals and tourists lined the route and watched as thousands of sheep walked through the city, the bells around their necks providing a noisy soundtrack.
The annual event was revived in 1994 as part of Madrid's annual Fiesta de la Trashumancia, after the Spanish parliament recognised the traditional routes shepherds used to herd their livestock.
Just a few centuries ago, the route would have taken them through quiet countryside, but today it sees them traverse some of the busiest areas of the city, including the Plaza Mayor, Madrid's main square.
Onlookers took pictures and videos on their phones, while some children held out tentative hands to stroke the sheep.
Many people were surprised by the unexpected sight in a city usually thronged with traffic.
"It was crazy that there were so many sheep, I've never seen anything like it. It was a great way to learn about Spanish history and Spanish culture," English teacher Maria Kouriabalis, a 22-year-old American who has been living in Madrid for a month, told Reuters.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)