Senator Bernie Sanders defeated Hillary Clinton in the Wisconsin primary on Tuesday, his sixth straight victory in the Democratic nominating contest and the latest in a string of setbacks for Mrs. Clinton as she seeks to put an end to a prolonged race against an unexpectedly deft and well-funded competitor.

Mrs. Clinton’s defeat does not significantly dent her comfortable lead in the race for the 2,383 delegates needed to secure the Democratic nomination. But the loss underscores her problems connecting with young and white working-class voters who have gravitated to Mr. Sanders’s economic message — a message he will now take to economically depressed parts of New York State ahead of the April 19 primary there.

Mr. Sanders’s victory came after he had hardly left Wisconsin in recent days, pouring his energy and resources into securing a win that would help him put to rest any doubts that he could capture a major primary state, and providing his campaign with renewed focus as he strives for an upset in New York, Mrs. Clinton’s adopted home state.