Retail stocks shot higher on Wednesday, after upbeat earnings reports suggested consumer spending — the engine of the American economy — is still holding up, even as the global economy struggles.

Two large retailers, Target and Lowe’s, reported second-quarter profits on Wednesday that beat analysts’ expectations, throwing cold water on the view that a global industrial slump was beginning to bleed into the broader American economy.

“A lot of people were thinking, ‘Gosh, is the American consumer going to be slowing down their spending,’” said King Lip , chief strategist at the wealth management firm Baker Avenue. “But the reality is that’s not really the case.”

Stocks of consumer-focused companies led the S&P 500, which finished the day up 0.8 percent. Target jumped 20.4 percent, and the home improvement chain Lowe’s rose 10.4 percent, making them the two best-performing stocks in the S&P 500. Retail stocks dominated that list on Wednesday: Nordstrom rose 5.5 percent, Kohl’s jumped 4.9 percent and Gap rose 4 percent.