WASHINGTON (Reuters) - U.S. worker productivity increased at its fastest pace in two years in the third quarter, helping to curb growth in labor costs, but the trend remained weak.

The Labor Department said on Thursday that nonfarm productivity, which measures hourly output per worker, rose at a 3.1 percent annual rate. The increase ended three straight quarters of decline.

Productivity fell at a revised 0.2 percent rate in the second quarter, which was previously reported as a 0.6 percent pace of decline. Economists polled by Reuters had forecast productivity rising at a 2.0 percent rate in the third quarter.

Productivity was unchanged compared to the third quarter of 2015.

The surge in third-quarter productivity was flagged by a report last week showing an acceleration in gross domestic product during the same period.

The economy grew at a 2.9 percent pace in the third quarter after expanding at a 1.4 percent rate in the April-June period.

Output per worker in the third quarter jumped at a 3.4 percent rate, also the fastest pace since the third quarter of 2014. That was up from the 1.6 percent pace notched in the April-June period.

The increase in output came despite total hours worked rising only at a 0.3 percent rate in the third quarter, slowing from a 1.7 percent pace of increase in the second quarter. That reflected a drop in hours for the self-employed.

Unit labor costs, the price of labor per single unit of output, rose at a 0.3 percent pace in the third quarter after increasing at a downwardly revised 3.9 percent rate in the second quarter.

Unit labor costs were previously reported to have increased at a 4.3 percent rate in the second quarter.

Third-quarter unit labor costs rose at a 2.3 percent rate compared to the same period of 2015. Hourly compensation per hour increased at a 3.4 percent rate in the third quarter after increasing at a 3.7 percent pace in the prior quarter. The strong quarterly increases suggest a pickup in wage growth. Hourly compensation rose at a 2.3 percent rate from a year ago.

(Reporting by Lucia Mutikani; Editing by Paul Simao)