A 3,000-strong demonstration against draft legislation on public safety and cutbacks to public services turned violent, with protesters using sticks to attack police cars.
Although backed by police unions, the draft legislation has been heavily criticised by opposition parties.
It is seen as repressive and has been labelled an attempt by the government to silence demonstrations against its handling of the economic crisis.
There is also anger over legislation aiming to impose heavy fines for offenses such as causing serious disturbances outside parliament.
Penalties of up to €30,000 could be set for misdemeanors such as insulting the state, or burning the Spanish flag.
Despite protests, the bill is likely to be approved by parliament as the ruling political party has an absolute majority in both chambers.