By Anna Hirtenstein and Ben Eisen

U.S. stocks edged higher Thursday as investors showed cautious optimism that Congress will reach an agreement on fiscal stimulus measures aimed at parts of the economy.

The S&P 500 rose 0.7% in afternoon trading, extending the broad-market index's rally into a second day. The Dow industrials climbed 0.3% and the tech-heavy Nasdaq Composite advanced 0.6%.

The S&P 500 climbed Wednesday to its highest close in over a month after President Trump tweeted his support for individual spending packages aimed at small business, airlines and delivering checks to households.

"It's still all about stimulus at this point: we're seeing markets move on optimism that some kind of package is going to get done," said Esty Dwek, head of global market strategy at Natixis Investment Managers. "It's just a question of how much the Republicans will agree to."

Discussions appear to remain ongoing, though Republicans and Democrats remain at odds over crucial details. House Speaker Nancy Pelosi and Treasury Secretary Steven Mnuchin spoke briefly Wednesday about a stand-alone stimulus bill for the airline industry, sending carriers' stocks higher. On Thursday, Mrs. Pelosi signaled she wouldn't support such a bill without a broader coronavirus aid package.

Applications for jobless benefits last week remained elevated at 840,000, slightly higher than economists' expectations for 825,000, reflecting a slow pace of recovery in the labor market. This metric remains historically high, despite dropping sharply from a peak of near 7 million in March.

"These are still high in the grand scheme of things. They've stabilized over the course of the last few months, but they're also not really going down," said Peter Dixon, an economist at Commerzbank. That will likely put additional pressure on Congress to agree on a package of coronavirus-relief measures, he said.

Meanwhile, the market's continued rise has made some investors nervous that speculative buying has pushed stocks to expensive levels, putting them at risk for a reversal even if the economy continues to improve.

"We spend half our time right now telling people how dangerous things are," said Cole Smead, president and portfolio manager at Smead Capital Management, a value-investing firm.

Thursday's rise was led by energy companies. The S&P 500 energy sector was up 2.4%. Oil prices climbed on the prospect of a boost to U.S. growth, with the global Brent crude benchmark adding 2.7% to $43.11 a barrel.

Shares of IBM gained 5.2% after it said that it was spinning off its managed infrastructure services unit into a new public company as part of a strategy to build up its cloud computing business.

Regeneron Pharmaceuticals shares rose 1.7% after Mr. Trump said an experimental coronavirus treatment made by the company was key to his recovery. A spokeswoman for the drugmaker on Wednesday said Regeneron has applied to the Food and Drug Administration for emergency-use authorization for its experimental treatment.

Shares of Eli Lilly, another drugmaker mentioned by the president in a Wednesday evening video posted on Twitter, climbed 2.1%.

Shares of Eaton Vance surged 48% after Morgan Stanley said it was buying the fund manager for $7 billion. Morgan Stanley, which is pushing further into the money management business, rose 0.8%, slightly outperforming an index of bank stocks.

After a massive run in shares of the largest companies, some investors say they believe that smaller firms are poised to outperform. The small-cap Russell 2000 Index has risen 7.6% so far this month, more than triple the rise of the S&P 500. Attractive valuations and expectations of higher inflation may boost them further, according to Doug Ramsey, chief investment officer at the Leuthold Group.

"Generally when small and mid caps start to outperform, it's a multi-year cycle," he said.

Overseas, the pan-continental Stoxx Europe 600 rose 0.8%. In Asia, most major benchmark stock indexes gained. Hong Kong's Hang Seng Index was an exception, slipping 0.2%. That followed reports that the Trump administration is discussing potential curbs to digital payments platforms developed by Chinese tech companies Tencent Holdings and Ant Group on the grounds of national security. Markets in mainland China remain closed for a holiday.

Write to Anna Hirtenstein at anna.hirtenstein@wsj.com and Ben Eisen at ben.eisen@wsj.com

(END) Dow Jones Newswires

10-08-20 1308ET