The Dow gained nine-tenths of a percent, the S&P 500 climbed nearly six-tenths and the Nasdaq added three-tenths of a percent.

A Commerce Department report showed U.S. retail sales dropped 0.8% in January, which was a bigger decline than expected.

That edged up bets for a Fed rate cut in May, but most investors still think June is more likely, according to the CME Group's FedWatch Tool.

Investor optimism has been buoyed by earnings, as roughly 80% of S&P 500 companies have beaten Wall Street's expectations, LSEG data showed.

Robert Conzo, CEO and Managing Director of The Wealth Alliance, believes that's because most businesses have spent the past 18 months or so preparing for a recession - which so far hasn't come.

"When you set up for something bad, that doesn't happen at the end of the day, that's probably a pretty good thing. And I think companies are managing their P&L very, very well. And managing to get the bottom line stronger and stronger and stronger. And on top of that, you have a consumer that still is resilient, they are still driving forward, spending on and on and on. So you got a consumer spending, you got companies that are managing their P&L real strong. And I think that's really why that we have a revenue stream happening the way it is."

In company news, Google parent Alphabet dropped more than 2% after investment firm Third Point dissolved its stake in the tech giant.

And Apple shares were pressured during the session as Warren Buffett's Berkshire Hathaway trimmed its large stake in the iPhone-maker and Soros Fund Management entirely dissolved its stake. But the stock bounced back in late trading and closed down only marginally.

On Friday, a producer price index report will provide more clues about the direction of the economy.