The Dow Jones Industrial Average traded 259 points higher, or 1%. The S&P 500 gained 0.8% while the Nasdaq Composite jumped 0.8%.
The better-than-expected results come at a time when traders are worried about a possible U.S. economic slowdown. Those fears have led investors away from riskier assets like equities in favor of traditionally safer assets like gold and Treasurys.
"A very mild recession could begin in 2020 but the stock market data don't support that just yet. That could change in the next rally, but it doesn't support it right now," said Paul Schatz, president at Heritage Capital.
Target shares surged more than 16% to a record after the retailer posted second-quarter results that topped analyst expectations. The company's same-store sales, a key metric for retailers, expanded by 3.4%. Analysts expected growth of 2.9%.
Lowe's jumped around 10% on its second-quarter earnings report. CEO Marvin Ellison said the company capitalized on strong "holiday event execution and growth in Paint and our Pro business to deliver strong second quarter results."
"We're in the camp that there is strength in the broad-based consumer. It's underpinned by low inflation, decent wages and jobs growth," said Tom Martin, senior portfolio manager at Globalt.
Bryan R. Smith | AFP | Getty Images
Traders work on the floor of the New York Stock Exchange on June 8, 2017 in New York.
But Bank of America CEO Brian Moynihan thinks the U.S. consumer is strong enough to keep the economy growing.
"The underlying consumer is doing well and making more money. More importantly, they're spending more money," he told CNBC's Becky Quick, noting the bank's consumer base has spent $2 trillion in 2019 thus far. "The U.S. consumer continues to spend and that will keep the U.S. economy in good shape."
Investors on Wednesday digested minutes from the Federal Reserve's meeting. The minutes showed the Fed has no "pre-set course" for cutting rates. The Fed cut rates by 25 basis points in July, while signaling that it was only a "midcycle adjustment" and the central bank was not returning to the stimulus era.
The major indexes maintained most of their gains following the release of the minutes.
The U.S.-China trade war remained on investors' radars after President Donald Trump made new comments about the trading relationship with the European Union. "Dealing with the European Union is very difficult," Trump told reporters at the White House.
"We have all the cards in this country because all we have to do is tax their cars and they'd give us anything we wanted because they send millions of Mercedes over. They send millions of BMWs over," he added. Trump is due to meet with other EU leaders this week at the G-7 meeting in France.