US economic growth blew past expectations in the second quarter, boosted by consumer spending and inventory building despite high interest rates, government data showed Thursday, after a slow start to the year.

The world's biggest economy grew 2.8 percent in the April to June period, up from 1.4 percent in the first three months this year, said the Commerce Department.

The figure was markedly above the 1.9 percent rate economists anticipated -- a reassuring sign that consumption remains resilient.

The acceleration "primarily reflected an upturn in private inventory investment and an acceleration in consumer spending," said the Commerce Department.

This was "partly offset by a downturn in residential fixed investment," it added.

While sectors like manufacturing and housing have been struggling after the Federal Reserve rapidly hiked interest rates in 2022 to combat surging inflation, consumption has been stronger than analysts expected.

This gave the economy a boost despite rates hovering at their highest levels in more than two decades -- making borrowing more expensive for individuals and companies.

A key factor underpinning consumption has been the robust labor market, which saw continued wage growth and businesses reluctant to let go of workers after difficulties in hiring during the pandemic.