Spain has tipped back into recession, official data showed Monday, grim news for a cash-strapped economy hobbled by rising debt, soaring unemployment and deeply troubled banks.

Spain's gross domestic product shrank by 0.3 percent in the first quarter of 2012, equalling the slump in the final quarter of 2011, according to preliminary data from the National Statistics Institute.

The return to recession, blamed on weak domestic demand only partially compensated by exports, comes barely two years after Spain emerged from the last downturn at the start of 2010.

It was no surprise just days after an even more pessimistic diagnosis by Bank of Spain, which estimated the economy shrank 0.4 percent in the first quarter.

Despite growing opposition to cuts during a recession with 24.4-percent unemployment in the first quarter, the government has vowed to meet its tough deficit-cutting targets so as to regain market confidence.

Tens of thousands of people took the streets on Sunday to protest against the conservative Popular Party's austerity measures, especially those affecting health care and education.

"Looking ahead, we fear that things are likely to get worse before they get better," warned INGeconomist Martin van Vliet.

"Indeed, the ongoing drag from real estate and the sheer scale of Spain's planned fiscal adjustment -- more than four percent of GDP this year -- mean that the recession will almost certainly deepen in the coming quarters, pushing unemployment to even more dramatic highs."

Doubts about Spain's ability to meet its deficit goals have been amplified by the plight of the banks, many bogged down in bad loans extended during a property boom which collapsed in 2008.

Standard & Poor's on Monday downgraded the ratings of the top Spanish banks, including Santander and BBVA, after slashing the country's credit standing because of the deficit and recession.

The banks affected include Santander and its subsidiary Banesto, BBVA, Banco Sabadell, Ibercaja, Kutxabank, Banca Civica, Bankinter and the local unit of Barclays.

An economy ministry official, who declined to be named, said the government was studying a scheme to allow banks to split off their bad loans and place them into a separate agency.

The agency would not be a 'bad bank' -- a special vehicle used in countries such as Ireland to help stabilise the banking system -- because the state itself would take no part, the official said.

Banks that joined the scheme would have to set aside financial provisions that recognise the sharply reduced market value of the loans, extended during the housing bubble.

"It is so banks can go back to doing their work as banks and someone else can take care of selling the assets," the official said.

Bank of Spain figures on Friday showed commercial banks held problem real estate loans worth 184 billion euros, some 60 percent of their property portfolio at the end of 2011.

The ratio of bad loans -- those at least three months in arrears -- hit an 18-year high in February of 8.15 percent of total credit extended, the highest since 1994, central bank figures show.

"While we see the 'bad bank' scheme currently being contemplated by the Spanish government as a positive step towards more clarity, it is unlikely to improve the banking sector's capital position unless accompanied by capital injections," ING's Van Vliet said.

Spain aims to lower the public deficit -- the shortfall in revenues to spending -- to 5.3 percent of GDP this year and 3.0 percent of GDP next year, after allowing it to hit 8.5 percent of GDP in 2011.

The accumulated public debt is officially forecast to leap to 79.8 percent of GDP this year from 68.5 percent at the end of 2011.