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 used to herd livestock.
Once they passed through quiet countryside, but on Sunday the shepherds, many of whom wore traditional dress, had to cross some of the busiest areas of the city, including the Puerta del Sol, one of Madrid's main squares.
Locals and tourists lined the way, snapping pictures of the sheep that wore tinkling bells around their necks.
"I really didn't expect this in the city, in the capital.
"It's amazing," said Sandra Van Arkelem, 57, from the Netherlands "So many people are joining and enjoying it".
Persons:
Puerta, Ana Sar, Sandra Van Arkelem, Michael Gore, Jessica Jones, Barbara Lewis
Organizations:
Thomson
Locations:
Madrid, Spain, MADRID, Sol, Mallorca, Netherlands