NEW YORK, June 17 (Reuters) - The euro climbed on Thursday to a three-week high against the U.S. dollar after a strong Spanish government bond sale soothed worries about the country's finances and triggered a squeeze in short positions.

Gains in the euro were limited, however, and the dollar fell sharply versus the yen after disappointing U.S. economic data fueled risk aversion.

The Philadelphia Federal Reserve Bank reported that factory activity growth plunged in the U.S. Mid-Atlantic region, and the Labor Department reported an unexpected rise in U.S. jobless claims.

The Swiss franc rallied broadly after the Swiss National Bank dropped its promise to act decisively against an excessive rise in the franc and said that for now deflation risks have largely disappeared.

Philly Fed was slightly weaker than expected and that's contributed to equities turning around and the pretty significant gain in the yen, said John Doyle, senior currency strategist at Tempus Consulting in Washington. In the near term it causes some worry about the U.S. growth outlook.

In late morning trading, the euro rose 0.4 percent to $1.2357 EUR=, off a session peak of $1.2413 hit on electronic trading platform EBS, the highest level since May 28.

The spread of Spanish government bond yields over benchmark German Bunds narrowed from a euro lifetime high after the auction. Technical factors added to the momentum as stop-losses on stale short positions in the euro were triggered through $1.2360, traders said.

Analysts at Action Economics said euro zone central banks were reportedly among the buyers, along with interest from a sovereign account.

The euro has regained more than 5 cents from a four-year low of $1.1876 set on EBS last week, though it remains more than 13 percent lower year-to-date.

Technical analysts at Commerzbank said the euro's correction could continue toward resistance at $1.2445/1.2570 -- the 2009 low and the 38.2 percent retracement of the move down from April to June.

Despite the euro's advance, analysts said worries about Spanish banks remain and the market will be looking for the results of bank stress tests which the Spanish central bank said would be published soon.

The auction went reasonably well but with rising yields it's not that much of a surprise. There are still worrying signs for Spain, particularly stresses in the Spanish bank funding market, said Lee Hardman, currency strategist at BTM-UFJ.

We think the euro rally is being driven by position adjustment rather than fundamentals in particular, Hardman added.

European Union leaders moved toward agreement on Thursday on ways to strengthen budget discipline and economic policy coordination among the 27 member states to contain a euro zone debt crisis.

Against the yen, the euro fell 0.4 percent to 112.07 yen EURJPY=. The dollar lost 0.8 percent to 90.71 yen JPY=, after falling 1 percent earlier to a session low of 90.52.

The Swiss franc rose versus the euro and the dollar after the SNB took a step toward tightening its extraordinarily loose monetary policy, judging that economic recovery is robust enough to back off a pledge to fight a rise of the Swiss franc.

The central bank held interest rates at ultra-low levels as expected.

The euro EURCHF= fell from around 1.3877 francs to a session low of 1.3759, according to Reuters data, edging towards its all-time low of 1.3731 francs hit on June 9.

The dollar CHF= hit a one-month low of 1.1096 francs. (Additional reporting by Gertrude Chavez-Dreyfuss and Neal Armstrong in London; Editing by Leslie Adler)