The election was also the last competitive contest of the 2020 Democratic presidential primary, with Mr. Biden easily capturing the Democratic vote over Senator Bernie Sanders, who dropped out of the race last week.

The Wisconsin vote, held at in-person polling sites last Tuesday after an 11th-hour court ruling that voting should proceed despite the virus, came amid a pitched outcry from Democrats in the state and across the country that Republicans were making Wisconsinites choose between imperiling their health and exercising their constitutional right to vote.

Wisconsin Democrats spent the last week in a state of fury, angry that Republicans had forced in-person voting and risked spreading the coronavirus.

In Wisconsin’s 10 largest counties, Ms. Karofsky improved on the 2019 liberal Supreme Court candidate’s performance by at least five percentage points in nine of them. She flipped two such counties, Winnebago in the state’s Fox Valley, and Brown, which includes Green Bay.

Democrats spent the hours before results were released Monday afternoon bracing for a defeat and making the case that the Wisconsin contest was illegitimate.

“It was voter suppression on steroids,” said Tom Perez, the chairman of the Democratic National Committee. “They tried to steal this election in Wisconsin.”

Ben Wikler, the chairman of the Democratic Party of Wisconsin, said many lawsuits would be filed by voters who were unable to cast absentee ballots, or by candidates in the nearly 4,000 local races that were on the state’s ballot. There are at least eight pending lawsuits seeking partial revotes of the election, according to The Milwaukee Journal Sentinel.