MADISON, Wis. — In this traditionally Democratic state, where Republicans triumphed in Tuesday’s failed recall of Gov. Scott Walker, President Obama holds a thin cushion against economic and political woes: the shape-shifting November electorate.

Here in Dane County, which Mr. Obama carried overwhelmingly in 2008, the population has been growing at more than twice the state average. Minority voters have edged up as a share of the state population, while the number of working-class whites shrinks — making a state Democrats have carried in six consecutive presidential elections slightly more friendly to the party.

That’s no guarantee the Democratic incumbent can survive the effects of tough economic times with the coalition that gave him a double-digit victory four years ago. But in Wisconsin and other competitive states, demographic changes add another variable to a campaign conversation that has largely revolved around high unemployment and slow growth.

“A number of states are urbanizing and losing their historically large rural conservative vote,” said Jan van Lohuizen, a Republican pollster who advised President George W. Bush.