Prime Minister Mariano Rajoy announced Wednesday that Spain slashed its public deficit to 6.7 percent of economic output in 2012, a dramatic cut in the midst of a recession yet still short of its European Union target.
Rajoy's conservative government rammed through unpopular austerity cuts and tax increases as it struggled to lower the public deficit to an EU-agreed target of 6.3 percent of gross domestic product in 2012 from 9.4 percent the year before.
Spain's budget-cutting achievement will likely be welcomed by financial markets despite missing the goal set with Brussels.
But the cost-cutting, coming at a time when Spain is in deep recession with a jobless rate of 26 percent, has sparked regular, mass street protests.
"It represents a huge effort by the whole of Spanish society," Rajoy told a session of parliament.
"It will no doubt lead to a boost in confidence in Spain."
The deficit figure excludes the cost of rescuing Spain's banking system from a mountain of bad loans built up since a 2008 property crash, however.
The European Commission, the executive arm of the European Union, has allowed Spain not to count the bailout.
Spain has already spent more than 40 billion euros ($52 billion) to clean up its banks' balance sheets, using a rescue loan extended by its eurozone partners of up to 100 billion euros, and it will have to pay that money back.
"We will continue the clean up of the banking sector, which is essential for credit to flow and therefore for investment and job creation," Rajoy said.
The European Union last week estimated the overall Spanish public deficit at 10 percent of gross domestic product, saying the cost of the banking rescue accounted for 3.2 percentage points of the total.
Since coming to power in December 2011, Rajoy's Popular Party government has launched measures to find 150 billion euros in savings between 2012 and 2014 in spending cuts and tax increases.
For next year alone, the government's budget foresees 39 billion euros in austerity measures.
Spain, the eurozone's fourth largest economy, is deep in recession following the collapse of a decade-long building boom in 2008.
Spain's gross domestic product declined by 1.37 percent last year, slightly better than the 1.5-percent contraction predicted by the government.
The Spanish economy appeared to continue its contraction in the first quarter of 2013, the Bank of Spain said Wednesday in its latest monthly economic bulletin.
"The limited information available for the first quarter of 2013 indicates, in broad terms, that the tendency towards contraction, in a context of sluggish domestic demand, will continue," the bank said.
"Regarding private consumption, the latest available information provide several signs that, in general, are consistent with the persistence of weak household spending," it added.
The government forecasts an economic contraction of 0.5 percent in 2013 followed by an expansion of 1.2 percent in 2014, a significantly more optimistic forecast than that of most analysts and international organisations.
"The 2013 budget foresees the end of recession," Rajoy said.
The European Commission predicts the Spanish economy will contract by 1.4 percent this year and grow by 0.8 percent in 2014.
Th economic contraction will make it harder for the government to fulfill its promise to slash its annual public deficit to below an EU limit of 3.0 percent of gross domestic product by 2014.
Brussels predicts Spain will post a deficit of 7.2 percent in 2014.