Shepherds guided a flock of 2,000 sheep through Madrid's streets on Sunday in defence of ancient grazing, droving and migration rights increasingly threatened by urban sprawl and modern agricultural practices.

Tourists and city-dwellers were surprised to see the capital's traffic cut to permit the bleating, bell-clanking parade to pass the city's most emblematic locations.

Shepherds halted at the old town hall so the chief herdsman could hand authorities 25 maravedies — copper coins first minted in the 11th century — as payment for the crossing.

They then continued past Puerta del Sol — Madrid's equivalent of New York's Times Square — and past the Bank of Spain headquarters on their way to Retiro Park.

Children shrieked with joy as the sheep went from a trot to a gallop past a hamburger restaurant and luxury jewelry store in the city's toniest downtown quarter.

Since medieval times, shepherds have had the right to use droving paths crisscrossing a landscape that was once a checkerboard of woodland and grazing space.

Some herding routes have been used annually for over 800 years and Madrid sprawls across one dating back to 1372. Madrid became an important urban centre when King Philip II chose it as the capital of his vast empire in 1561.

The herd was accompanied by musicians and dancers dressed in regional costumes that have been worn by rural workers for centuries.

Spaniards are proud of their sheep-rearing traditions and hold native livestock in high esteem. The Merino breed has gone on to form the backbone of important wool industries in places such as Australia and South America.