By Anna Hirtenstein and Michael Wursthorn

The S&P 500 edged lower Thursday, as the broad index approached a correction while some technology stocks recovered recent losses.

Shares of Apple, Microsoft and other technology stocks pared solid gains in a topsy-turvy session that had seen major indexes bob above and below the flatline several times. The action suggested the stock market is now struggling to find direction after a stretch of volatility this month that through Wednesday had pulled the S&P 500 down more than 9% from its Sept. 2 closing record.

The index was up 0.2% to 3231. It would need to close at or below 3222.76 to enter a correction, which would mark a 10% drop from its recent high.

The broad index briefly fell below that level Thursday morning following data showing hundreds of thousands of Americans continue to rely on jobless benefits. It was the latest evidence that the economic recovery from the coronavirus pandemic will be drawn-out, especially with cases on the rise and lawmakers deadlocked on how to proceed with further fiscal stimulus.

Stocks made a U-turn after the Commerce Department said home purchases reached a 14-year high, highlighting how the pandemic is reshaping life and economic activity.

They also got a boost from reassurances from Senate Majority Leader Mitch McConnell via Twitter that the winner of November's presidential election would be inaugurated as planned in January. The tweet appeared to be a response to President Trump's refusal to commit to a peaceful transition of power a day earlier.

Investors appeared to capitalize on tech's depressed prices, some analysts said. Apple shares, for example, remain 21% below their all-time high, while Microsoft's stock is off by 12%.

Wall Street isn't flashing the all-clear sign just yet. Investors' list of concerns have only lengthened, setting the fall up to be a highly volatile period for the market, said David Lefkowitz, an executive director at UBS Global Wealth Management's chief investment office. The coronavirus pandemic, which appears to be worsening in certain parts of the world, remains at the top of that list, he said, followed by uncertainty around an election conducted through mail-in voting.

The S&P 500's flirtation with a correction is likely a reflection of the fact that investors don't expect further fiscal support before the election, he said.

"America sneezes and the rest of the world catches a cold: if you're being told that the world's largest economy will not recover without stimulus and they can't agree on a stimulus, then that has to be a negative piece of news," added Tony Yarrow, a multiasset fund manager at Wise Funds. "The mood among investors is extremely pessimistic at the moment."

On Thursday, the Dow Jones Industrial Average and the Nasdaq Composite swung alongside the S&P 500. The blue-chip index was recently up 48 points, while the tech-heavy Nasdaq lost 0.2%.

Tech stocks led the rebound, rising 1%. Apple shares added 1.2%, while Microsoft's stock gained 1.1%. Amazon.com and Google parent Alphabet, other tech heavyweights, were also up in recent trading.

Tesla, which has shed 21% so far this month, added 2.9%.

Health-care and energy stocks lagged behind, weighing on the broad index.

In bond markets, the yield on the benchmark 10-year Treasury edged down to 0.664%, from 0.676% Wednesday.

Overseas, the pan-continental Stoxx Europe 600 dropped 1% as investors weighed the prospect of stringent measures being introduced in countries such as Germany, France and the U.K. following a rise in infections.

In Asia, major benchmark stock indexes closed lower as the negative sentiment spread overnight. The Shanghai Composite Index retreated 1.7%, and Hong Kong's Hang Seng Index fell 1.8%.

Write to Anna Hirtenstein at anna.hirtenstein@wsj.com and Michael Wursthorn at Michael.Wursthorn@wsj.com