WASHINGTON—The U.S. economy expanded at its fastest pace since late 2011, but those gains could be reversed as superstorm Sandy and the fiscal cliff create a drag during the final three months of 2012.

The nation's gross domestic product—the broadest measure of goods and services produced in the U.S.—advanced at an annual rate of 2.7% between July through September, the Commerce Department said Thursday. The revised figure is up from the previously reported 2.0% gain and nearly matched economists' expectations for a 2.8% advance.

But the factors that led to the upward revision—growing inventories, strong federal spending and robust exports—may not persist. Add in other headwinds, and the economy could struggle to grow in the fourth quarter.

"We will have a negative impact on fourth-quarter GDP from the effects of Sandy, but there's a rebuilding process and we'll have a positive impact in subsequent quarters," Dallas Fed President Richard Fisher said in a speech Thursday.

Sandy, which struck in late October, caused widespread disruptions and closed many businesses in the Northeast. In addition, the fiscal cliff, the host of tax increases and spending cuts slated to hit in January unless lawmakers strike a deal, is holding back business spending and could also slow consumers.

But from July through September the economy grew at the best three-month pace since the fourth quarter of 2011. The advance was the third-largest quarterly gain of the current recovery.

Increased federal government spending and inventory growth, however, are unlikely to persist, said Nigel Gault, chief U.S. economist at IHS Global Insight.

"The immediate growth outlook is soft, he said. "The special factors that helped quarter three won't help quarter four, while the fiscal cliff uncertainty will continue to be a drag."

IHS Global Insight projects the economy will grow at just a 1.0% rate during the current quarter.

The increase in private inventories was the primary driver of the upward revision to third-quarter GDP. The new data show the change in private inventories contributed 0.77 of a percentage point to growth. Initially, the government estimated the change was a 0.1 percentage-point drag.

Some economists see the additional stockpiling as a drag on the fourth quarter because businesses won't need the same level of production to meet demand. But Tim Hopper, chief economist at TIAA-CREF, said the buildup reflects growing confidence that Americans will continue to spend.

Consumer spending increased by 1.4% during the third quarter. However, that was a downward revision from the previous reading.

"Businesses are starting to wake up to the fact that consumers are spending and cranking up production to match," he said. The third-quarter growth shows "the economy is stronger than Wall Street is giving it credit for."

Sandy and government spending cuts will somewhat hold back growth in the fourth quarter and early next year, Mr. Hopper said, but he is forecasting stronger gains later in 2013.

The upward revisions to inventory gains and exports helped offset downward adjustments to consumer spending and business investment.

Thursday's report also gave the first read of third-quarter corporate profits. Profits from current production were up 8.7% from a year earlier. The figure measures business income generated from production during the quarter and excludes items, such as capital gains, which revalue existing assets.

By another measure, corporate profits after-tax and unadjusted for inventories and capital consumption advanced 18.6% from a year earlier. The after-tax numbers more closely reflect what companies would report in quarterly accounting.

Separately, the number of new unemployment claims decreased by 23,000 to a seasonally adjusted 393,000 in the week ended Nov. 24, the Labor Department said.

The four-week moving average, which smooths out shifts in weekly data, increased by 7,500 from the previous week to 405,250, reflecting the effect of Sandy. That is the highest average level since October 2011.

A Labor Department analyst said there was no noticeable impact from Sandy in the latest week, but it was difficult to read too much into the figures because the non-seasonally adjusted data are particularly volatile toward the end of the year.

—Todd Buell contributed to this article.

Write to Neil Shah at Neil.Shah@wsj.com