By PAUL WISEMAN

WASHINGTON — The U.S. economy grew at a better-than-expected 2.6 percent annual rate from July to September, ending two consecutive quarters of economic contraction and overcoming punishingly high inflation and interest rates.

Estimates from the Commerce Department on Thursday showed the nation’s gross domestic product — the biggest gauge of economic output — rose in the third quarter after contracting in the first half of 2022. Helped restore growth in the world’s largest economy.

The latest GDP report comes as Americans, worried about inflation and the threat of recession, begin voting in the midterm elections that will determine whether President Joe Biden’s Democratic Party wins. The party retains control over the Congress. Inflation has become a key issue for Democrats in Republican attacks on the economy.

Consumer spending, which accounts for about 70% of US economic activity, rose at a 1.4% annual pace in the July-September quarter, down from a 2% pace in the April-June period. Last quarter’s growth also got a big boost from exports, which grew at an annualized pace of 14.4%. Government spending also helped: It grew at a 2.4 percent annual pace, the first such increase since early last year, with sharply higher defense spending.

Housing investment, though, sank at a 26% annual pace, hurt by rising mortgage rates as the Federal Reserve aggressively raised borrowing costs to combat chronic inflation. It was the sixth consecutive quarter of decline in residential investment.

Overall, the outlook for the overall economy has turned bleak. The Fed has raised interest rates five times this year and is set to do so again next week and in December. Chair Jerome Powell has warned that more Fed hikes will cause “pain” in the form of higher unemployment. Concerns are growing about the prospect of a recession next year.

“Looking ahead, risks are to the downside, particularly for consumption, as households face challenges from higher prices and a possible slowdown in employment,” said Rubela Farooqi, chief of High Frequency Economics. The US Economist wrote in a research note.

Inflation is still near a 40-year high, with continued price increases putting pressure on households across the country. At the same time, rising interest rates have derailed the housing market and are likely to cause widespread damage over time. The longer Russia’s war on Ukraine drags on, the more bleak the outlook for the global economy gets.

Economists noted that the third-quarter gain in GDP could be accounted for entirely by a rise in exports, which added 2.7 percentage points to the economy’s expansion. Export growth will be difficult to sustain as the global economy weakens and a strong U.S. dollar makes U.S. products more expensive in foreign markets.

Thursday’s report offered some encouraging news on inflation. The GDP data showed the price index rose at an annualized rate of 4.1 percent from July to September, down from 9 percent in the April-June period – less than economists expected and the last three months of 2020. The smallest increment after Raise hopes that the Fed may decide to slow its rate hikes soon.

Last quarter’s US economic growth reversed an annual decline of 1.6% from January to March and a 0.6% annual decline from April to June. An informal definition of a recession is a persistent quarterly decline in economic output. But most economists have said they believe the economy is out of recession, citing a still resilient job market and steady consumer spending. Most of them have expressed concern, though, that a recession is likely next year as the Fed continues to tighten credit.

Preston Caldwell, chief U.S. economist at financial services firm Morningstar, noted that the economy’s contraction in the first half of the year was largely driven by factors that did not reflect its underlying health and therefore “is very likely that it does not constitute real economics. Slowness.” He pointed, for example, to the decline in business inventories, a cyclical phenomenon that reverses itself over time.

High borrowing costs have weakened the domestic market in particular. The average rate on a 30-year fixed-rate mortgage, up from just 3.09% a year ago, is approaching 7%. Existing home sales have fallen for eight consecutive months. New home construction is down about 8 percent from a year ago.

Still, the economy retains pockets of strength. There is a very important job market. Employers have added an average of 420,000 jobs a month this year, making 2022 the second best year for job creation (behind 2021) in Labor Department records going back to 1940. The unemployment rate was flat at 3.5 percent last month. A half-century low.

However, recruitment is declining. In September, the economy added 263,000 jobs – solid but the lowest total since April 2021.

International events are causing further concern. Russia’s invasion of Ukraine has disrupted trade and driven up energy and food prices, creating a crisis for poor countries. The International Monetary Fund this month downgraded its outlook for the global economy to 2023, citing the war.