The Spanish Senate has voted to approve direct rule over Catalonia, shortly after the region's parliament declared independence.

Prime Minister Mariano Rajoy immediately called for calm despite the vote, which Spain is deeply set against.

"The rule of law will restore legality to Catalonia," he said on Twitter.

No country in the world has expressed support for independence for Catalonia, a region in northeastern Spain that has 7.5 million people.

But separatist politicians in Catalonia's regional parliament erupted in applause and chants when the chamber's main speaker, Carme Forcadell, announced the passing of a motion to declare the region's independence.

Catalan parliament votes on independence: in pictures Show all 15 1 /15 Catalan parliament votes on independence: in pictures Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Catalan independence supporters react to the news that the Catalan Parliament voted to declare independence Getty Images Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Catalan separatists react as the Catalan Parliament votes the independence of Catalonia Rex Catalan parliament votes on independence: in pictures Catalan parliament votes for independence People react as they celebrate the unilateral declaration of independence of Catalonia AP Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Catalan government members, pro independence deputies, and Mayors from pro indpendence towns sing the Catalan anthem REUTERS Catalan parliament votes on independence: in pictures Catalan parliament votes for independence People celebrate after the approval of the declaration of a uniteral independence EPA Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Catalan pro-independence mayors raise their batons as they gather in the parliament AFP/Getty Images Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Catala president Carles Puigdemont sings the Catalan anthem AFP/Getty Images Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Protesters shouts slogans during a rally outside the Catalan Parliament AP Catalan parliament votes on independence: in pictures Catalan parliament votes for independence People react as they watch on giant screens a plenary session outside the Catalan regional parliament REUTERS Catalan parliament votes on independence: in pictures Catalan parliament votes for independence An aerial view shows thousands of people gathering near the Catalan regional Parliament EPA Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Protesters during a rally outside the Catalan Parliament AP Catalan parliament votes on independence: in pictures Catalan parliament votes for independence People react as they watch on giant screens REUTERS Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Leftist party CUP leader Anna Gabriel casts her ballot REUTERS Catalan parliament votes on independence: in pictures Catalan parliament votes for independence A protester reacts AP Catalan parliament votes on independence: in pictures Catalan parliament votes for independence Popular Party leader Xavier Garcia Albiol gestures REUTERS

Regional President Carles Puigdemont and his vice president, Oriol Junqueras, exchanged congratulatory embraces and handshakes following the ballot.

Outside, thousands who had gathered near the parliament building to call for independence cheered, with some dancing and raising glasses after seeing the vote and the counting live on a giant screen.

The motion that passed calls for beginning an independence process that includes drafting Catalonia's new top laws and opening negotiations "on equal footing" with Spanish authorities to establish cooperation.

Shortly before the vote in Madrid, Mr Rajoy made his case for measures to keep Spain unified. The conservative leader, who received sustained applause before and after his speech, told the chamber that Spain was facing a challenge not seen in its recent history.

What is happening in Catalonia is "a clear violation of the laws, of democracy, of the rights of all, and that has consequences," he said.

Mr Rajoy said his government's first move would be to dismiss Mr Puigdemont and his regional ministers if the Senate approves the Spanish government's use of Article 155 of the Constitution in a vote.

The special measures, he said, were the only way out of the crisis, adding that Spain wasn't trying to take away liberties from the 7.5 million Catalans but instead trying to protect them.

Catalonia Spain PM Rajoy asks Senate for powers to depose Catalan president Puigdemont

He added that the measures were aimed at restoring order and has promised to call a new regional election once that is achieved.

If they are granted, it will be the first time in four decades of democratic rule that the national government in Madrid would directly run the affairs of one of Spain's 17 semi-autonomous regions, a move that will likely fan the flames of the Catalan revolt.

Mr Rajoy's conservative Popular Party has an absolute majority in the Senate, thus guaranteeing the approval of his proposals. But he has also sought support from the country's main opposition parties. It will then be up to the government when to implement the measures taking over the Catalan government.