Riot police were on standby as tens of thousands took to the streets in Madrid, Barcelona and other cities across Spain on Monday to demand a vote on whether to rid Spain of its royal family.

The protests came after Spain's King Juan Carlos, who led the country's transition from dictatorship to democracy but faced scandals during the nation's near financial meltdown, announced on Monday he would abdicate in favour of his son Felipe, making way for a "new generation".

Prince Felipe, 46, a former Olympic yachtsman, would presumably take the title King Felipe VI.

Far-left parties called for a national referendum to abolish Spain's monarchy after the king made his announcement.

Juan Carlos has been on the throne for 39 years and was a hero to many for shepherding Spain's democratic and economic transformation.

He came to power in 1975, two days after the death of Francisco Franco.

His popularity took a blow following royal scandals, including one involving an extravagant elephant-shooting trip he took in 2012 at the height of Spain's financial crisis.

The Botswana trip, which came to light after he broke his right hip and was flown home privately for surgery, undermined the king's earlier declarations that he lost sleep thinking about unemployed young people.

Juan Carlos's daughter, Princess Cristina, and her husband, Inaki Urdangarin, are also under investigation in a corruption case.