US economic growth unexpectedly picked up steam in the second quarter thanks to resilience among consumers and businesses in the face of high interest rates.

Gross domestic product rose at a 2.4% annualized rate after a 2% pace in the previous three months, the Commerce Department’s initial estimate showed Thursday. Consumer spending increased at a 1.6% pace, more than forecast, after surging at the start of the year.

The Federal Reserve’s preferred underlying inflation metric advanced at a slower-than-expected 3.8% pace. Treasury yields rose and the S&P 500 opened higher.

The US economy is in better shape than economists had expected it would be just a few months ago. While forecasters are split on the odds of a recession, a strong labor market, sturdy consumer spending and now easing inflation have fueled hopes that the US will avoid a downturn.

The Fed staff is no longer forecasting a recession, Chair Jerome Powell said Wednesday after the central bank raised interest rates by a quarter percentage point. Powell also said that it’s his own expectation that the Fed can cool inflation without a big increase in unemployment.

“Growth is outpacing expectations even as the monetary policy stance has become restrictive,” Rubeela Farooqi, chief US economist at High Frequency Economics, said in a note. “A strong household sector that continues to benefit from positive job growth and rising real incomes should keep growth on a positive trajectory this year.”

Still, headwinds persist with the Fed’s benchmark interest rate at a 22-year high and some signs of consumer strain bubbling.

The personal consumption expenditures price index grew at an 2.6% annualized pace in the April to June period, the smallest advance since the closing months of 2020. Excluding food and energy, the index rose at the slowest pace in more than two years. June data will be released Friday.

The persistent strength of the jobs market remains a key source of support for the economy. Separate data out Thursday showed applications for unemployment benefits retreated to the lowest level since late February. Continuing claims, which can offer insight into how quickly out-of-work Americans are able to find a new job, declined to the lowest since January.

The GDP data showed services spending rose at a 2.1% annualized rate, led by housing and utilities, health care and financial services. Outlays on goods increased at a 0.7% rate, after surging by the most in nearly two years in the prior period. Inflation-adjusted spending data for June, and any revisions to prior months, will also be released Friday.

Nonresidential fixed investment increased at the fastest pace in more than a year. Business spending on structures continued to grow at a breakneck pace, bolstered by recent efforts to shore up domestic factory production.

The Biden administration championed a series of bills — the Infrastructure Investment and Jobs Act, the Inflation Reduction Act and CHIPS Act — that provide both direct funding and tax incentives for private companies to invest in areas like semiconductors and electric vehicles.

Outlays for equipment surged at a 10.8% rate, the most in more than a year, after decreasing in the previous two quarters. Spending on intellectual property products also accelerated.

Inflation-adjusted final sales to private domestic purchasers — a key gauge of underlying demand — rose 2.3% after a 3.2% at the start of the year. Those are the strongest back-to-back gains since 2021.

Residential investment decreased for a ninth-straight quarter. While the rapid rise in interest rates sent the housing market into a tailspin last year, the sector is now showing signs of stabilizing.

Read more: Housing-Market Rebound Poses Challenge for Fed’s Inflation Fight

--With assistance from Kristy Scheuble.

This article was provided by Bloomberg News.