WASHINGTON — The United States economy grew at a surprisingly robust 4.1 percent annual pace in the third quarter, the Commerce Department said on Friday. It was the strongest advance in nearly two years and only the third time the economy had expanded that quickly from one quarter to the next since 2006.

It is the latest evidence that the generally sluggish recovery is gaining strength, though economists noted that the rate of growth over a longer period remained at a trot, not a gallop — a pace of about 2.5 percent a year.

“We continue to believe that underlying growth will remain on a moderate trend,” said Joshua Shapiro, the chief United States economist at MFR, a consulting firm. “The outlook is greatly dependent on the direction of the labor market, and hence the path of wage and salary growth and the ability of consumers to expand spending.”

With stronger growth, the job market is improving, but earnings and employment remain far from healthy levels, economists say. The unemployment rate fell to 7 percent in November from 7.8 percent a year earlier. But that improvement is to a substantial extent because workers are leaving the labor force, not because of a greater number of jobs. At the same time, many working households continue to struggle because stagnant incomes have barely kept up with the modest pace of inflation.