The S&P 500 posted a slight gain on Thursday, led by strong quarterly results from Microsoft, as Wall Street slogged through the busiest day of the earnings season.

The broad index climbed 0.2% to 3,010.29. The Nasdaq Composite gained 0.8% to close at 8,185.80.

Microsoft reported earnings per share of $1.38 on revenue of $33.06 billion for the previous quarter. Analysts polled by Refinitiv expected a profit of $1.25 per share on revenue of $32.23 billion. Microsoft's strong quarterly performance was driven in part by Azure, its cloud business, which saw revenues grow by 59% on a year-over-year basis. The stock closed 2% higher.

"MSFT delivered strength across the board with no blemishes and importantly gave stronger than expected December quarter guidance which speaks to an inflection point in deal flow as more enterprises pick Redmond for the cloud," Dan Ives, an analyst at Wedbush Securities, said in a note.

The Dow Jones Industrial Average struggled, however. The 30-stock index fell 28.42 points, or 0.1% to 26,805.53 as shares of 3M pulled back 4.1%. 3M cut its full-year earnings forecast, overshadowing stronger-than-expected results for the quarter.

Overall, the major indexes struggled for direction as investors tried to make sense of the corporate earnings.

"For the market to really cheer this, we're going to have to see more companies beat estimates and raise guidance," said Rob Haworth, senior investment strategy director at U.S. Bank Wealth Management.