THE AMERICAN DREAM has long been predicated on a strong and growing middle class. That’s why there has been so much talk in recent years about the withering of that dream. Growing income inequality and stagnant wages among all but those at the top have made the goal of a stable middle-class life an elusive one for more and more Americans. (In 2011, CommonWealth devoted a whole issue of the magazine to the eroding American Dream.)

A new report from Pew Charitable Trusts offers at least a small glimmer of hope that the situation is improving, even if slowly and, so far, only modestly.

Pew’s Stateline, which provides regular reporting and data analysis on state trends, says every state but one (Wyoming) saw the middle class lose ground between 2000 and 2013. The period from 2013 to 2016, however, saw the middle class “slowly clawing its way back,” says the report.

The report defines middle class households as those earning between two-thirds and twice the state size-adjusted median household income. By that benchmark, 38 states saw a larger share of households fall into the middle class in 2016 than in 2013. The longer view is not as rosy. In 2000, in 43 states at least half of all households fell into that middle-class income bracket. In 2016, that was true in just 30 states, though the number had increased from 28 states in 2013.

Massachusetts was among the 38 states that saw growth in the middle class from 2013 to 2016, but it was not much to get excited about — a growth of 0.6 percentage points, from 48.7 percent to 49.3 percent. It also leaves the Bay State among the 20 states where less than half of all households meet the middle-class benchmark.

Curiously, Connecticut, which has been the focus of lots of bad economic and state budget news, was one of just three states (along with Georgia and Montana) where the middle class grew by 2 percentage points or more from 2013 to 2016.

Boston Mayor Marty Walsh weighed in on the plight of the middle class on Wednesday in a speech in Washington to North America’s Building Trades Unions. Walsh told the union leaders that critics predicted he would “give the store away” if elected mayor because of his labor background. “Boy were they wrong,” he said.

Walsh went on to tick off all the positive economic news in Boston since he took office in 2014, including 85,000 new jobs, falling unemployment, $20 billion in new development, 52,000 new housing units built or approved, and the arrival of corporate headquarters of General Electric, Reebok, and other multinational firms.

He acknowledged that Boston was ranked the No. 1 city for inequality when he took office. He credited job training programs, union apprenticeships, and a boost in the state minimum wage with reducing inequality by 17 percent since that time and said Boston has fallen to seventh in inequality when it comes to US cities.

“We moved Boston to the forefront of the global economy while at the same time reducing inequality,” said Walsh. “We figured out how we can be a city that’s world class that works for the middle class. That’s a game changer. It’s our strategy, and it’s working in Boston.”

It’s a hopeful message, but Walsh is swimming very much against the tide.

In yesterday’s New York Times, columnist Thomas Edsall said the booming knowledge-based economy in coastal cities like Boston is turning those areas into places of the well-heeled and low-wage service workers, with the middle class increasingly hollowed out.

Edsall quotes from an essay this month in CityLab by well-known urban affairs writer Richard Florida that points to housing costs as the overwhelming driver of inequality in coastal America.

“The rise in housing inequality brings us face to face with a central paradox of today’s increasingly urbanized form of capitalism,” writes Florida. “The clustering of talent, industry, investment, and other economic assets in small parts of cities and metropolitan areas is at once the main engine of economic growth and the biggest driver of inequality. The ability to buy and own housing, much more than income or any other source of wealth, is a significant factor in the growing divides between the economy’s winners and losers.”

For all the worthwhile efforts in job training and other strategies to boost incomes, that housing divide — which is acute and worsening in Boston — describes exactly why being a city that’s both world class and working well for the middle class may be more urban legend than realistic goal.