Stocks closed the second quarter on a bullish note, helped by Greece's efforts to stave off default and despite the end of the Federal Reserve's stimulus program.
For the quarter, the major averages were flat to lower. The Dow Jones Industrial Average inched up 0.8 percent over the last three months, while the S&P 500 eased 0.4 percent and the small-stock Russell 2000 fell 1.8 percent.
For Thursday, the averages rose more than 1 percent across the board, pushed higher by semiconductors and industrials, while big banks lagged.
The Greek parliament passed a second crucial voteto introduce 28 billion euros of spending cuts, tax hikes and privatizations.
In exchange, the International Monetary Fund will release the latest installment, or tranche, of its bailout fund to keep the Greek government running.
Market momentum also got a boost from a surprise in the Chicago Fed manufacturing reading. The Purchase Manager's Index registered a 61.1 reading, up from May's 56.6 and ahead of expectations for a 53. Anything about 50 is considered an expansion.
At the same time, investors were not dismayed by another sign of weakness in the jobs market. The Labor Department reported 428,000 new jobless claims filing, more than the expected 420,000 and indicating continued weakness in the vital part of the economy.
Energy stocks also led gainers on the Standard & Poor's 500 while utilities and financials lagged.
On the Dow, 26 of the 30 components were positive, with Hewlett-Packard leading the charge higher.
Volume was light after back-to-back sessions of heavy trading.
Big banks were one of the few industries having a rough day.
Bank of America led the few Dow losers, a day after the company announced it had reached an $8.5 billion settlement against claims on bad loans from Countrywide Financial, which BofA purchased during the financial crisis.
Morgan Stanley shares also were lower after Mitsubishi UFJ completed its conversion of Morgan shares, which will cause the bank to take a $1.7 billion charge for the second quarter.
On the Nasdaq tech baromester, First Solar surged after the Energy Department offered $4.5 billion in lona guaratnees to back three projects by the Tempe, Ariz.-based company.
Investor complacency grew, as volatility indicators for the S&P 500 tumbled across the board. The near-term Volatility Index tumbled below 17, while the iPath Short-Term Futures exchange-traded note, which measures volatility across one- and two-month intervals, dropped below 22.
Elsewhere, Standard & Poor’s warned that it will slash America’s credit rating to selective default if Congress fails to reach agreement on the Budget deficit and debt ceiling and misses its debt payment on August 4.
Thursday marks the end of the Federal Reserve's second round of money-printing, or quantitative easing (QE2), with the Fed ending its $600 billion bond-buying program; the central bank gave no information as to whether there would be more monetary easing in the future.
Though unchanged earlier in the session, bonds took a beating as stocks rose. The benchmark 10-year note lost 10/32 in price to yield 3.14 percent, its highest in more than a month.
In the currency markets, the euro used hopes for the Greece deal to gain some ground against the dollar , which was off about half a percent against a basket of foreign currencies.
In company news News Corporation announced the sale of the loss - making MySpace to Specific Media for $35 million. In the UK, the government passed News Corp's bid to buy out the remainder of satellite broadcaster BSkyB, rejecting competition complaints.
Credit card companies Visa and Mastercard slumped after huge gains in Wednesday's session when the Federal Reserve agreed to a higher-than-expected cap of 22 centson debit card transactions. Both companies saw trading in their shares briefly halted after they both gained more than 10 percent, reaching upside limits and tripping market circuit breakers.