DETROIT — From the start of her presidential campaign 11 months ago, Hillary Clinton has presented an upbeat assessment of an improving economy, saying Wall Street and corporations would be held accountable, but must be part of the solution for all Americans to benefit from the country’s prosperity.

“I want to be the president for the struggling, the striving and the successful,” she often said.

Her message has at times collided with an angry electorate drawn to the populist pitch of Senator Bernie Sanders. In Michigan on Tuesday, it crashed.

The state’s voters, scarred by the free trade deals associated with Mrs. Clinton and her husband that have been widely blamed for the loss of American manufacturing jobs, delivered a surprise victory to Mr. Sanders, who railed here against “disastrous trade agreements written by corporate America.”

While his victory did little to bridge the delegate gap with Mrs. Clinton, the loss in Michigan left the Clinton camp confronting an urgent quandary as the Democratic contest moves to other Midwestern states like Ohio, Illinois and Missouri, which will vote on Tuesday: Will Mrs. Clinton’s we’re-all-in-this-together approach work in what has been called an off-with-their-heads election year?