WASHINGTON, June 1 (Reuters) - U.S. construction spending increased more than expected in April, boosted by single-family homebuilding, though rising mortgage rates amid ‌the war with Iran continued to cast a shadow over the housing ‌market.

The Commerce Department's Census Bureau said on Monday that construction spending rose 0.4% after a downwardly ​revised 0.2% increase in March. Economists polled by Reuters had forecast construction spending gaining 0.2% after a previously reported 0.6% rise in March.

Construction spending increased 0.9% on a year-over-year basis in April. Spending on private construction projects advanced 0.4% after ‌gaining 0.2% in the prior ⁠month.

Investment in residential construction climbed 0.8% after rising 0.6% in March. Spending on new single-family housing projects increased 1.4%.

Mortgage rates ⁠have shot up as the U.S.-Israeli war with Iran stoked inflation. The popular 30-year fixed mortgage rate averaged 6.53% last week, a nine-month high, data from mortgage finance ​agency ​Freddie Mac showed. It averaged 5.98% at ​the end of February, when the ‌war started, as Freddie Mac and Fannie Mae expanded purchases of mortgage-backed securities.

Rising mortgage rates are weighing on demand for housing and constraining builders' ability to break ground on new single-family housing projects. Builders are also facing higher costs from tariffs, land and labor shortages.

Spending on multi-family housing units, which account for ‌a small share of the housing market, ​fell 0.3% in April.

Investment in private nonresidential structures ​such as power plants and ​factories fell 0.2% in April. Spending on nonresidential structures has ‌contracted for nine straight quarters, despite a ​surge in the ​construction of data centers to support artificial intelligence.

Investment in public construction projects increased 0.4% after rising 0.2% in March. State and local government construction ​spending edged up 0.1% ‌in April while outlays on federal government projects jumped 4.8%, likely ​related to the building of detention centers amid an immigration crackdown.

(Reporting ​by Lucia Mutikani; Editing by Andrea Ricci )