Spanish Prime Minister Mariano Rajoy says he is considering using constitutional powers to suspend Catalonia's autonomy and prevent the region from gaining independence.
Catalan separatists claimed an overwhelming victory in an independence referendum held last Sunday, but Madrid dismissed the vote as invalid and illegal.
Amid rising tensions over the result, Catalan president Carles Puigdemont has said separatist leaders "have to talk" to the Spanish government.
However, Mr Rajoy has rejected calls for mediation and warned he would "ensure that any declaration of independence will lead to nothing".
Asked if he would trigger a part of the Spanish constitution to dissolve the Catalan government and call a local election, Mr Rajoy told El Pais newspaper: "I don't rule out absolutely anything that is within the law.
"Ideally, it shouldn't be necessary to implement extreme solutions but for that not to happen things would have to be changed.
"I would like the threat of an independence declaration to be withdrawn as quickly as possible."
The Spanish leader vowed to keep 4,000 police deployed to Catalonia before the referendum in the region until the crisis ends.
An estimated 50,000 took part in a pro-union demonstration in Madrid
He also admitted "some mistakes were made" by officers who launched a violent crackdown against voters last Sunday.
However, Mr Rajoy insisted separatists shared blame for the unrest after putting "national sovereignty" at risk.
On Saturday, tens of thousands of people attended rival demonstrations on both sides of the independence debate.
In Barcelona, demonstrators chanted "we want to talk" and dressed in white to symbolise their desire for mediation and a peaceful resolution.
Thousands in Barcelona called for constitutional talks
Similar rallies were held in Bilbao, Zaragoza and Valladolid under the slogan "Spain is better than its leaders".
Meanwhile, an estimated 50,000 gathered at Madrid's Cibeles fountain and waved red and yellow Spanish flags in support of unity.
Some chanted: "Less hate, more understanding."
Mr Puigdemont is set address the Catalan parliament on Tuesday evening, but it remains unclear what he plans to say.
Reports suggest the regional parliament will declare independence unilaterally at its next sitting.