U.S. productivity grew at an annual rate of 2.9 percent in the second quarter, the fastest pace in more than three years, while labor costs actually fell.

 It was the strongest advance since a 3.1 percent gain in the first quarter of 2015.

The April-June increase in productivity followed a much weaker 0.3 percent rate of gain in the first quarter, the Labor Department reported Wednesday. It was the strongest advance since a 3.1 percent gain in the first quarter of 2015. Labor costs actually fell at a 0.9 percent rate in the second quarter, the weakest showing in nearly four years.

Productivity, a key factor determining how fast the economy can grow and how much living standards can increase, has been anemic throughout this expansion. The strong second quarter gain is expected to be only a temporary blip.

Productivity is the amount of output per hour of work. The big jump in the second quarter reflected the fact that the gross domestic product, the country’s total output of goods and services, accelerated to a growth rate of 4.1 percent in the second quarter, the strongest quarterly gain since 2014.

That second-quarter acceleration was accompanied by a much smaller gain of 1.9 percent in the number of hours worked. The combination of stronger output and a smaller increase in hours worked led to the strong increase in productivity.

However, economists do not expect the second quarter improvement will significantly alter the long-run trend of very meager gains in productivity.

For all of last year, productivity grew by 1.1 percent and that followed a minuscule 0.1 percent rise in 2016.

Andrew Hunter, U.S. economist for Capital Economics, noted that “quarterly productivity growth tends to be quite volatile.” He said while the second quarter productivity gain was strong, the average gain for the past four quarters has been 1.3 percent, no change from the lackluster pace of the past decade.

Similarly, economists said that while labor costs dropped by 0.9 percent in the second quarter, this decline had followed a 3.4 percent rise in the first quarter with the 1.9 percent gain over the past year a better reflection of how labor costs are performing currently.

Finding a solution to the slowdown in productivity growth is one of the key economic challenges facing the country. Rising productivity is imperative in boosting living standards. Productivity gains allow companies to pay workers more without having to raise the cost of their products, which can exacerbate inflation.

Economists are uncertain why productivity has remained static during a nine-year expansion. For the past seven decades, from 1947 through 2017, productivity has turned in average annual gains of 2.1 percent. But between 2007 through 2017, productivity growth has slowed to about half that pace, with average annual gains of just 1.3 percent.

The Associated Press contributed to this article.