WASHINGTON — Despite the booming economy, homelessness in the United States rose slightly for the second year in a row, with spikes in high-rent cities like New York and Seattle, according to an annual report released on Monday by the Department of Housing and Urban Development.

Over all, the national rate of homelessness rose by a modest 0.3 percent to 552,830 people without stable living conditions, the report found. But that represented the second annual increase after seven straight years of declines — the result, in part, of rapidly increasing housing costs that have only recently shown signs of leveling off.

“I’m not sure victory is the right word to use here,” said Ben Carson, the secretary of housing and urban development. He attributed some of the increase to about 4,000 people who have been temporarily displaced from their homes, including by natural disasters.

But he also blamed the “headwinds of rising rents” for stubbornly high homelessness rates, which remain relatively flat despite what economists have called the most favorable labor market in generations.