Stocks turned higher on Wall Street in midday trading Thursday after shaking off an early slide following a report signaling the U.S. economy is either already in a recession or well on its way.

The S&P 500 was up 0.7% as of 12:03 p.m. Eastern. The Dow Jones Industrial Average was up 0.6% and the Nasdaq was 0.5% higher. Smaller company stocks also rose, lifting the Russell 2000 by 0.7%.

The indexes fell in the early going after the Commerce Department reported that the economy shrank from April through June, contracting at a 0.9% annual pace. The latest decline in the gross domestic product — the broadest gauge of the economy — followed a 1.6% annual drop from January through March. Consecutive quarters of falling GDP constitute an informal, though not definitive, indicator of a recession.

The GDP report for last quarter pointed to weakness across the economy. Consumer spending slowed as Americans bought fewer goods. Business investment fell. Inventories tumbled as businesses slowed their restocking of shelves, shedding 2 percentage points from GDP.

The Federal Reserve is trying to slow the U.S. economy to fight inflation without tipping it into a recession. The central bank raised its key short-term interest rate by 0.75 percentage points on Wednesday, bringing it to the highest level since 2018.

The move sparked a broad market rally led by technology stocks that helped give the Nasdaq its biggest gain in over two years. The major indexes are now all on pace for a weekly gain, extending Wall Street’s strong July rally.

Technology stocks and retailers, restaurant chains and other companies that rely on direct consumer spending helped lift the S&P 500 Thursday. Microsoft rose 2%, Target gained 2.6% and McDonald’s was 1.1% higher.

Communication services stocks were the only laggards. Meta Platforms fell 5.3% after the social media giant said its revenue fell last quarter for the first time ever, dragged down by a drop in ad spending.

In a busy week of corporate earnings reports investors have focused on what companies are saying about inflation and the impact rising interest rates are having on their business and customers.

Markets were spooked Monday after retail giant Walmart warned that its profits are being hurt by rising prices for food and gas, which are forcing shoppers to cut back on more profitable discretionary items such as clothing.

Stanley Black & Decker slumped 12.7% Thursday after the tool maker’s second-quarter results fell short of Wall Street’s estimates. The company noted that demand significantly slowed in May and June.

Oshkosh fell 7.3% after the company reported weaker-than-expected quarterly results and lowered its 2022 profit guidance, citing lingering supply chain disruptions and inflation.

Meanwhile, Spirit Airlines shares rose 4.2% after JetBlue said it agreed to buy the budget airline for $3.8 billion to create the nation’s fifth largest airline. The agreement, which still requires regulator and shareholder approval, comes a day after Spirit’s attempt to merge with Frontier Airlines fell apart.

Bond yields were broadly lower. The two-year Treasury yield, which tends to move with expectations for the Fed, fell to 2.88% from 2.98% late Wednesday. The 10-year yield, which influences mortgage rates, fell to 2.69% from 2.74%.