WASHINGTON — U.S. construction spending was unchanged in July as weakness in spending on government projects offset gains in home building and the strongest month for non-residential construction on record.

Construction spending was flat in July but declines in May and June were revised to show slight gains, the Commerce Department reported Thursday. Spending in June is now reported up 0.9 percent while May showed an increase of 0.1 percent.

The advance in July was led by a 1.7 percent increase in spending on non-residential projects which rose to an all-time high of $429.5 billion at a seasonally adjusted annual rate. Office building and shopping centers both showed solid gains.

Residential construction increased 0.3 percent in July but spending on government projects fell 3.1 percent, the fourth drop in the past five months.

Overall construction spending stood at a seasonally adjusted annual rate of $1.15 trillion in July, up a modest 1.5 percent from a year ago.

Residential construction, which had fallen for three straight months, rebounded slightly in July on the strength of increased spending on home remodeling projects. Spending on single-family home construction was down 0.2 percent while spending on apartment construction dropped 0.6 percent. Total home construction was up 1.9 percent from a year ago.

Non-residential construction has been up sharply in four of the past five months with July activity 7.1 percent higher than a year ago. In addition to solid gains in office and shopping center work, there were also strong increases in manufacturing and power plant construction. But spending on construction of hotels and motels was down 1.2 percent.

The decline in government spending reflected a 3.3 percent fall in spending at the federal level and a 3.1 percent drop in state and local construction activity.

The overall economy grew at a modest 1.1 percent annual rate in the spring after an even weaker 0.8 percent gain in the first quarter. But economists expect growth will rebound to close to 3 percent in the current July-September quarter, helped by stronger construction activity.