The U.S. economy grew at its strongest pace in two years in the third quarter, according to government data released Friday morning, helping to allay fears that the world’s largest economy might be stalling after a sustained period of weakness.

Between the months of July and September, the nation’s gross domestic product expanded at an annualized rate of 2.9 percent, slower than before the financial crisis, but fast enough to create new jobs and pare down the unemployment rate, economists said. The reading surpassed expectations of economists surveyed by Bloomberg News, who had forecast growth of 2.6 percent.

The data showed the nation’s economy bouncing back following months of stubbornly sluggish economic growth. Growth in GDP — a broad measure of America’s economic activity — has remained below 2.7 percent for the previous seven quarters.

“It’s a sigh of relief after just over barely 1 percent growth in the first half of the year,” said Stuart Hoffman, chief economist at PNC.

The report, released by the Commerce Department, combined strong exports with middling consumer spending and weak business investment. Overall, it was steady enough to lift expectations that the Federal Reserve will raise interest rates before the end of the year.

Economists, however, cautioned that the recovery shouldn’t be overestimated, as growth in the quarter was driven by several events unlikely to be repeated in the near future.

One of those events was a surge in shipments of American soybeans to South America, which suffered from a bad harvest. That helped lift exports 10 percent in the third quarter, the biggest increase in nearly three years.

Growth was also buoyed as businesses made new purchases to restock their inventories, after struggling to draw down on large stockpiles of goods in previous quarters.

“Obviously, the headline number, 2.9 percent, was better than we’ve seen in several quarters,” said Michael Feroli, chief U.S. economist at J.P. Morgan. “But as we looked at the details, they weren’t as encouraging as the headline might suggest.”

Ben Herzon, an economist at Macroeconomic Advisers, called the third quarter GDP figure “solid” but “not a sign of persistent strength.” Businesses that restocked inventories in the third quarter are unlikely to make as many purchases in the fourth. And the surge in exports is unlikely to be repeated, especially if the Fed raises interest rates, putting upward pressure on an already strong dollar.

“While it’s pretty good news for the third quarter, it’s not as good for the fourth quarter,” he said.

The data comes a little more than a week before many Americans go to the polls in the presidential election. It’s unclear whether the GDP data will be enough to sway voter opinions toward either political camp at such a late date.

Democratic nominee Hillary Clinton is likely to seize on the figures to bolster her case that President Obama’s efforts are helping to revive the U.S. economy. At the same time, the sluggish economic growth of past years is likely to leave Republican nominee Donald Trump plenty of room to continue to criticize Democratic policies.

The growth figures, combined with an uptick in consumer inflation, raised expectations for an interest rate hike in December, though not at the Federal Reserve’s upcoming Nov. 1-2 meeting. Inflation remains below the Fed’s target rate of 2 percent but is creeping closer to that level.

“On the margin, this report should support the argument that the economy could handle a very small rate of increase,” said James Marple, senior economist at TD Economics.

Economists cautioned that the GDP data is a preliminary reading and will be revised twice more in coming months. These revisions can often give a substantially different picture of the economy.

For now, the picture is one of cautious optimism. Consumer confidence remains reasonably high, and the economy’s long-run pace of growth appears to be slightly above 2 percent, economists say — enough to add new jobs to payrolls and slowly raise wages.

However, the data also revealed a few sources of lingering weakness. Construction of new houses and government spending at the state and local levels were sluggish, while American businesses still seemed hesitant to invest in new equipment.

Economists said the weakness in business investment continues to be a concern, since that type of expenditure helps expand the economy in the long run. Still, some expect it to rise in coming quarters. Businesses may be temporarily withholding investment because of uncertainty about markets and the election, they say.

In addition, the U.S. energy sector is showing signs of a nascent rebound that could help revive investment. A recent uptick in oil prices, from historic lows of less than $30 a barrel earlier this year, appears to have boosted drilling, mining and energy production, data show.

Consumer spending, which accounts for about two-thirds of the U.S. economy, also remains a mixed picture, with spending moderating in the third quarter after surging in the second. Buyers remain relatively cautious, with fairly high levels of saving, said Feroli of J.P. Morgan.