The demonstrators in the Spanish capital burnt Moroccan flags and chanted "Free Sahara now", demanding Morocco quit the Western Sahara which it annexed
after Spanish settlers withdrew in 1975.
Protest organisers the National Coordination of Associations in Solidarity with
Sahara accused the Spanish government of turning a blind eye to "Morocco's crimes" in the former colony.
The leaders of Spain's two main labour unions and actor Javier Bardem joined the protest.
Moroccan security forces raided a camp in Western Sahara on 8 November.
Moroccan officials say 12 people were killed, including 10 from its security forces, but the separatitst Polisario Front, says Moroccan forces killed dozens of people and wounded more than 4,500.
Spain on Friday demanded urgent explanation from Morocco about what happened.
Several journalists, most of them Spanish, have been prevented from going to the camp. Reporters from France’s Le Monde and Le Figaro are believed to be the only foreign journalists to have been given authorisation to enter.
Sources in the camp say that shops and offices are open but Moroccan soldiers and police are keeping it under close surveillance, with entrances tightly controlled.