Stocks rose sharply on Wednesday for a second straight day as strong earnings from General Motors and Facebook lifted sentiment. But the major averages still posted big October losses.

The Dow Jones Industrial Average surged 241.12 points to 25,115.76, led by Visa, bringing its two-day gain to about 650 points. The gained 1.1 percent to 2,711.68 as consumer discretionary and energy outperformed. The Nasdaq Composite advanced 2 percent to 7,305.90 and briefly climbed out of correction territory.

Still, the major averages posted big losses for the month:

The S&P 500 lost 6.9 percent in October, its biggest one-month slide since September 2011, when it fell 7.2 percent.

The Dow dropped 5.1 percent to post its biggest monthly fall since January 2016, when it dropped 5.5 percent.

The Nasdaq plunged 9.2 percent, its largest monthly pullback since November 2008, when it shed 10.8 percent.

"The earnings story is flip-flopping between being very good and pretty good," said Craig Birk, CIO at Personal Capital. "There's also some optimism that a breakthrough on trade could happen."

"The drop this month came out of nowhere. Usually that's a sign of a correction and not a bear market," he said. "Usually a bear market rolls more slowly."

General Motors shares spiked 9.1 percent after the company reported quarterly results that easily topped expectations. The company said it sold fewer cars in the third quarter, but at a higher price, boosting its bottom line.

Facebook shares rose 3.8 percent after the company reported on Tuesday better-than-expected earnings. CEO Mark Zuckerberg said during the company's earnings call Facebook plans to invest significantly in its business next year. He also said Facebook plans to build products such as Facebook Watch and Instagram TV.

The stock's rise on Wednesday led Amazon, Apple, Netflix, and Alphabet higher.

Equities have been under pressure this month amid renewed concern over rising interest rates and U.S.-China trade relations, as well as worries about slowing corporate earnings growth. Tech shares have also taken a big hit, adding pressure to the broader indexes. Facebook's gains Wednesday helped ease these losses, but the sector still fell more than 8 percent for October.