Spain sold nearly 4 billion euros of bonds with ease at an auction on Thursday that kicked off its funding program for a daunting 2013 when Madrid must shoulder regional debt needs and will struggle to meet deficit targets.

The Treasury beat the top end of the target of 2.5-3.5 billion euros at borrowing costs that were slightly down on previous outings of the same paper but remain too high for comfort.

The average yield on the 2021 bond was 5.517 percent, compared with around 5.6 percent for the benchmark 10-year on the secondary market, a long way from over 7 percent levels in July.

"It's a clear reflection that sentiment in Spain has improved markedly," said bond strategist at RIA Capital Markets Nick Stamenkovic.

"They are already funded for 2012 and the market is betting that Spain will ask for a bailout early next year when they face a (wall of issuance)."

Madrid faces some 28 billion euros in debt redemptions in January while in 2013 the country's funding needs rise to 207 billion euros from 186 billion euros this year.

This could go higher still if it overshoots its deficit target of 6.3 percent this year and 4.5 percent next year, which the Bank of Spain warned on Wednesday was possible.

Spain sold 3.6 billion euros of a bond maturing October 31, 2015, 645 million euros of a bond due July 30, 2017 and 1.5 billion euros of paper maturing April 30, 2021.

Concerned that the welfare system could slip into deficit this year, from a balanced budget target, theeconomy ministry said separately that the social security reserve fund will subscribe a new 3.3 billion euros 5-year sovereign bond.

Madrid is also expected to help struggling regional governments, cut out of debt markets, which could add a further 40 billion euros to its debt bill.

Spain's economy has been in recession for a year, the second since 2009, and is not expected to return to growth until late next year at the earliest. Some 25 percent of Spanish workers are unemployed and deep spending cuts and tax hikes have fuelled increasingly violent protests across the country.

However, Spain's risk premium versus Germany has fell to around 423 basis points from above 650 bps since the European Central Bank said it would buy up debt on the open market to hold down interest rates for any country that signs up for aid.

Madrid has said it wants to be sure the ECB measure would reduce financing costs, citing a spread of 200 bps as more representative of economic fundamentals, though the central bank's head, Mario Draghi, said he could not make such a promise.

© Thomson Reuters.