| NEW YORK
NEW YORK U.S. stocks ended a volatile quarter on Thursday with their biggest four-day rally since September as positive economic data and a temporary resolution of Greece's debt crisis indicated further gains in July.
Midwest business activity showed surprising strength this month, lifted by a jump in new orders, the Institute for Supply Management-Chicago said. That helped calm concerns about the economy that have weighed on markets for two months.
Overseas, Greece's parliament approved measures to implement budget cuts and assets sales, making Greece eligible for financial aid to avoid a debt default.
Major indexes rose, including the benchmark S&P 500, which climbed above its 50-day moving average at 1,317, suggesting an accelerated move higher was possible. The index is up 4.1 percent so far this week, its best four-day rally since September 2010.
"The resolution in Greece allows us to throw away one more question mark, and as we do that we become more confident," said Peter Andersen, portfolio manager at Congress Asset Management in Boston.
"Managers are also using the occasion to trim their cash positions at the midway point through the year, meaning we'll start July 1 with optimism."
For the second quarter, the Dow rose 0.8 percent while the S&P 500 cut sharp losses to end down 0.4 percent and the Nasdaq slipped 0.3 percent. In June, the S&P fell 1.8 percent, the Dow lost 1.3 percent and the Nasdaq shed 2.2 percent.
Concerns that a Greek default could spark another global credit freeze had been a major headwind for stocks since May, sending the S&P down more than 5 percent at one point, though most of those losses were recouped this week.
All 10 S&P business sectors rose on Thursday, led by industrials .GSPI, up 1.7 percent, and information technology .GSPT, up 1.4 percent. Heavy-equipment maker Joy Global Inc JOYG.O rose 5.7 percent to $95.24 for the biggest percentage gain on the S&P while software company NetApp (NTAP.O) added 5.6 percent to $52.78.
The Dow Jones industrial average .DJI was up 152.92 points, or 1.25 percent, at 12,414.34. The Standard & Poor's 500 Index .SPX was up 13.23 points, or 1.01 percent, at 1,320.64. The Nasdaq Composite Index .IXIC advanced 33.03 points, or 1.21 percent, at 2,773.52.
Part of the rally came from end-of-quarter window dressing by fund managers, who typically sell losers and buy winners to make their portfolios look better.
So far this year, the Dow is up 7.3 percent, the S&P has gained 5 percent and Nasdaq rose 4.5 percent.
The Federal Reserve ended its $600 billion bond-buying program, known as QE2, on Thursday and has not offered any hints of more monetary easing. Markets were volatile in May and June, partly on concerns about QE2's end.
"Traders are a little afraid about QE2 ending with no real idea about what's coming next," said Doreen Mogavero, president of Mogavero Lee & Company in New York. "People will feel much better about the market, and volume will pick up when we see what comes next."
Volume was light, with about 6.88 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, below the year's daily average of 7.56 billion.
Shares of Ford Motor Co (F.N) gained 2.8 percent to $13.79 after an analyst projected the U.S. automaker increased market share in June.
EBay Inc (EBAY.O) rose 4.6 percent to $32.27 after both Citigroup and Bank of America-Merrill Lynch upgraded the stock, citing a Federal Reserve ruling that third-party networks like eBay's PayPal will not be regulated like payment networks.
About 11 stocks rose for every four that fell on the New York Stock Exchange, while on the Nasdaq, more than two stocks rose for every one that fell.
(Reporting by Ryan Vlastelica; Editing by Kenneth Barry)