Hewlett-Packard was the biggest gainer in the S&P 500. The technology giant rose $1.88, or 5.4 percent, to $37 after reporting better-than-expected results and its first sales increase in nearly three years. HP has been undergoing a multi-year restructuring under CEO Meg Whitman, who has laid off employees and cut back businesses that aren't profitable.
Bank of America was also among the market's biggest advancers. The company reached a $16.65 billion settlement with the Justice Department over its sale of mortgage-backed securities in the months leading up to the financial crisis. The settlement is by far the largest deal the Justice Department has reached with a bank over the 2008 mortgage meltdown. BofA rose 64 cents, or 4 percent, to $16.16.
Stocks opened higher and remained there throughout the day, although buying did pick up in the last hour of trading. Investors were encouraged by a report from the Department of Labor that claims for unemployment benefits, a proxy for the number of people who recently lost their jobs and are looking for work, fell by 14,000 last week to 298,000. The less-volatile four-week average was 300,750, below the average before the Great Recession.
Stocks have been rising steadily all month, due to better economic data and a cooling of tensions in Ukraine, Gaza and Iraq. The S&P 500 is on pace to have its best month since February.
"We've have been able to breathe a sigh of relief that those worst-case scenarios have been avoided, at least for the time being," said Ryan Larson, head of equity trading with RBC Global Asset Management.
Investors now turn to Friday, when Fed Chair Janet Yellen will give a speech at the Fed's annual conference of central bankers and other policymakers in Jackson Hole, Wyoming. Investors will be watching closely for clues into her thinking on the timing of interest rate increases.
Yellen's speech will come two days after the minutes from the Fed's July meeting showed that a majority of the central bank's policymakers believe the U.S. economy is improving enough for the bank to start raising interest rates sooner than previously thought. The debate on when the Fed should begin increasing rates, which have been near zero since 2008, has intensified in recent months as the Fed winds down its other economic stimulus.
Overall, it's been a quiet week for the market. Volumes are low as many Wall Street workers try to fit in their vacations before trading picks up after Labor Day. Thursday was the 10th-slowest trading day of the year and Wednesday was the fifth-slowest.
Benchmark U.S. crude for October delivery rose 51 cents to $93.96 a barrel in New York. In metals trading, gold fell $19.80 to $1,275.40 an ounce, silver fell eight cents to $19.42 an ounce and copper was little changed at $3.18 a pound.
The yield on the 10-year Treasury note dipped to 2.41 percent from 2.43 percent the day before.
In individual companies:
— Dollar General, Dollar Tree and Family Dollar all fell after Family Dollar rejected Dollar General's unsolicited $9 billion buyout offer, citing antitrust concerns. Also weighing on Family Dollar's decision was a deal Family Dollar reached with smaller discount retailer Dollar Tree last month. Dollar Tree fell 72 cents, or 1.3 percent, to $54.28, Dollar General fell 15 cents, or 0.2 percent, to $63.61 and Family Dollar fell 40 cents, or 0.5 percent, to $79.41.
— Sears Holdings lost $2.57, or 7 percent, to $33.38. The owner of Sears and Kmart said it lost $573 million in the last quarter, more than double what is lost the year before. It was the struggling company's ninth straight quarterly loss.