Spain sold the maximum amount targeted at a sale of bonds Thursday, and its cost of borrowing held well below highs reached on bond markets last week, helping ease immediate nerves over its ability to fund public finances.

The yields - ranging from around 5.19 to 5.54 percent on the 4--, 5- and 6-year paper - were the highest paid at a government sale since before the launch of the euro, but remained far below yields around 7 percent widely held as unaffordable.

That reflects improvement in Spain's position on markets over the past week, which has seen yields come down around 60 basis points to around a full percentage point below Italy's.

The Treasury sold 1.2 billion euros of a bond maturing in 2015, 1.15 billion euros of a 2016 bond, and 1.4 billion euros of a 2017 bond at Thursday's sale.

The stronger than expected demand saw the country's key risk spread between its ten-year bond yield and Germany's fall to a three-week low around 383 basis points.

As is the case so often these days, the focus probably was to just 'get the job done'. In that respect the auction was 'successful' -- range exhausted, most supply for the longest dated bond, said David Schnautz, strategist at Commerzbank.

The bid-to-cover ratio, an indicator of investor demand was 2.7 on the 2015 bond, after 2.1 last time, it was 2.8 on the 2016 bond, and it was 2.7 on the 2017 bond after 1.8.

The decent demand, however, contrasted with yields jumping to record highs, the highest since 1997 and Schnautz said he did not expect it to have a deeper impact on sentiment.

A flat performance for European stock markets signalled that global central bank action Wednesday to help bank currency lending had done little to ease the broader tension on euro zone markets, with attention focused on a leaders summit on December 9.

The average yield on the 2015 bond was 5.187 percent, up from 3.639 percent when it was last sold on October 6. The yield on the 2016 bond was 5.276 percent. It was last sold in February. The 2017 bond had an average yield was 5.544 percent, up from 4.782 percent at auction on October 20.

All came in slightly lower than where they were trading previously on the secondary market.

(Reporting by Nigel Davies; additional reporting by London government bonds desk; editing by Patrick Graham)