U.S. construction spending rose to its highest level in nearly 2 1/2 years in May as investment in residential and federal government projects surged, a rare dose of good news for the flagging economic recovery, Reuters reported.

Construction spending increased 0.9 percent to an annual rate of $830 billion, the highest level since December 2009, according to the U.S. Commerce Department, Reuters reported. The increase followed an upwardly revised 0.6 percent rise in April.

Economists polled by Reuters had expected construction spending to rise 0.2 percent after a previously reported 0.3 percent gain in April.

The gain in construction spending in May was driven by a 1.6 percent rise in private construction outlays. Spending on residential projects jumped 3 percent to the highest level since January 2009.

Private nonresidential construction spending rose 0.4 percent to the highest level since October 2009. Investment in multifamily residential projects surged 6.3 percent, while outlays for single-family buildings increased 1.8 percent.

Residential construction is expected to contribute to growth this year for the first time since 2005.

Spending on public-sector construction dipped 0.4 percent to $269.6 billion, down for the fifth month. However, outlays on federal government projects jumped 5.6 percent, the largest gain since December.

Spending on state and local government projects dropped 1 percent, falling for a fifth straight month.