Spain will sell up to 3.5 billion euros in bonds on Wednesday in an auction that should give clues on whether it can avoid the bailout contagion that has engulfed the much smaller economies of Greece, Ireland and Portugal.

Growing talk of Greek debt restructuring, despite official denials, has battered the bonds of financially weak euro zone members in the past few days, pushing Portugal's yields to new euro lifetime highs and Spain's close to record levels.

While Portugal has little to prove with a relatively small sale of short-term T-bills, Spain's auction of 2.5 billion to 3.5 billion euros in 10-year and 13-year bonds is being seen as a test of whether the country can decouple from the periphery's weaklings.

Portugal has followed Greece and Ireland in requesting an EU/IMF bailout and is currently negotiating a package that is expected to reach 80 billion euros and be agreed by mid-May.

But rising expectations that Greece will have to restructure its debt have further shaken investor confidence.

Yields leapt at a Spanish T-bill sale on Monday on concerns of contagion, which traders said set the tone for Wednesday's bond sale. Still, bond analysts said Spain could garner decent demand after its bonds cheapened in the market.

There is panic and overreaction to whatever risk lies ahead for Greece, and that has hit Spanish bonds as well, said Ioannis Sokos, debt strategist at BNP Paribas.

But Spain is on the right path and its bonds had already shown resilience to contagion before Portugal's bailout. It might be a good moment to re-enter (and buy), so they may see some good demand, he added.

Spain is the euro zone's fourth-largest economy, and if it were to need financial assistance it could stretch the euro zone crisis fund to breaking point.

Spanish 10-year bond yields were at 5.5 percent on Tuesday, just 20 basis points shy of a euro lifetime high.

Yields on the Spanish 10-year bond are expected to rise from a prior auction in March where they averaged 5.162 percent.

Yields on its 2024 bond, with a 4.8 percent coupon, were hovering at around 5.7 percent on the secondary market. Madrid last sold 2024 bonds in April 2009.

Economy Minister Elena Salgado on Tuesday played down the rise in debt costs as insignificant and down to market volatility in thin Easter holiday volumes.

PORTUGAL'S CHOICE TO STAY IN MARKET

Portugal, which in the midst of bailout negotiations with the EU and IMF, will offer a total of 750 million to 1 billion euros in three- and six-month Treasury bills.

Yields on the three-month paper are expected to rise above 4 percent compared to 3.686 percent in an auction in January, while six-month bill yields could push above 6 percent from 5.117 percent in an April 6 sale, held just before Portugal announced that it would seek a bailout.

Analysts say Portugal is issuing T-bills mainly to remain in the debt market, as Greece has done, and try to secure financing as long as possible until it receives funds from the bailout.

It's a choice, said Padhraic Garvey, a rate strategist at ING. If you can keep rolling over T-bills there are two main advantages. One is that you need less cash to call from external sources. The other is that it keeps the issuer in the market.

(Additional reporting by Shrikesh Laxmidas; Editing by Noah Barkin)