The Democrats’ seismic victory Tuesday in the unlikely political battleground of Alabama brought jubilation — and a sudden rush of confidence — to a party that has been struggling to gain its footing since Donald Trump won the presidency 13 months ago.

Democrat Doug Jones’s triumph, the result of a vigorous turnout of the party’s traditional voters and of Republican splintering in a deeply conservative state, sent a thunder clap across the national political landscape that Democrats hope will signify an emerging comeback at the start of the 2018 midterm election campaign.

In the immediate aftermath, Democratic leaders are eager to leverage a narrowed Republican majority in the Senate to try to stall the Trump agenda, including the GOP’s $1.5 trillion tax package.

And they plan to use the defeat of firebrand Republican Roy Moore, who faced allegations of sexual misconduct, to escalate their criticism of Trump’s character, believing the Alabama race may show that even the president’s core voters are growing wary of political figures dogged by claims of inappropriate behavior. Trump, who endorsed Moore, has been accused by more than a dozen women of groping or touching them without their consent, which he has denied.

More than anything, there was joy. After more than a year of partywide bickering in the wake of Hillary Clinton’s defeat and months of uncertainty over how to win back voters who abandoned the party in 2016, Democrats found solace in a stunning feat — beating a Trump-style Republican in one of the most ruby-red states in the nation.

“The recriminations have been tough and stupid, the Bernie Sanders people arguing with the Hillary people has been counterproductive. Jones sends a powerful signal not to do that,” said Robert M. Shrum, a longtime Democratic consultant who teaches at the University of Southern California. “It was a repudiation of Trump, despite the special circumstances, and we’re looking at a wave election next year.”

Amid the celebration, however, there were notes of caution in casting Jones’s success as a harbinger of the Democrats’ chances in next year’s elections, when many Senate Democrats will face difficult reelection contests.

Veteran strategists described the result as a crucial if fleeting thrill, and a crippling moment for a fractured Republican Party that is straining to hold its congressional ranks together.

“It’s a hard thing to generalize since Moore was such a singular figure,” said David Axelrod, a former senior adviser to President Barack Obama. “The practical implication in the Senate is that the Republicans’ margin slips to 51 seats, and it’s now very difficult for [Majority Leader] Mitch McConnell to navigate. Democrats will certainly have a role to play in moderating any legislation that comes through.”

Pointing to last month’s elections in Virginia, where Democrat Ralph Northam was elected governor and Democrats made surprising gains in the state legislature, Axelrod said that the “exodus of voters in suburban areas away from Republicans” remains the biggest takeaway from the elections in Alabama and Virginia this year. “Was it because of resistance to Trump? That’s what we’ve got to figure out before we know if the pattern will continue.”

Trump’s vulnerability in the fallout dominated Democrats’ discussions late Tuesday, especially on the issue of conduct. Exit polls in Alabama showed that most women and independents considered the allegations against Moore to be true, making Democrats wonder whether the resurgence this week of the accusations against Trump could damage the president’s political standing and burden the GOP.

“This shows that the president is a huge drag on Republicans,” Sen. Amy Klobuchar (D-Minn.) said in an interview. “Suburban voters and moderate Republicans have had it — from New Jersey to Virginia to Alabama.”

Preliminary exit poll results: How different groups voted in Alabama

A crowd of Democrats in recent days has called on Trump to leave office because of the allegations against him. That call comes as influential men across industries are being held accountable for alleged misconduct.

Lifting Democratic spirits nationally were the glimmers of a lurching electorate on Tuesday. Even white Republican voters in Alabama demonstrated that they were uneasy with Moore and perhaps with the Republican Party’s direction generally. Exit polls showed Jones won far more white voters than recent Democratic presidential nominees in Alabama, nearly 3 in 10 statewide.

“There is an incredible opportunity in some of these red states to compete,” said Chris Kofinis, a Democratic strategist and former chief of staff to Sen. Joe Manchin III (D-W.Va.). “Flipping a red seat energizes and excites the base. It fuels fundraising and it puts races that people weren’t thinking about playing in on the map and makes states like Arizona more important as people look ahead.”

Kofinis said Jones’s campaign also exposed unexpected GOP weaknesses.

“They showed how the Republican brand is more broken than people thought,” Kofinis said.

Jones’s mobilization of African American voters was critical to his victory, and Democrats saw in his turnout emphasis a model for how the party must mobilize its essential voter coalitions in the coming year. In the final weekend of the campaign, Sen. Cory Booker (N.J.) and other prominent black Democrats rallied for Jones.

Geoff Garin, a pollster who advised Northam and worked on past Clinton campaigns, said “it’s arithmetic. Midterms in the past haven’t always been good for Democrats, and they’ve lost seats because good Democratic voters stayed home. Simply having a strong ground game isn’t enough. You can’t only look at swing voters. In the age of Trump, you have to get out your base.”

That includes women, said Boston-based Democratic consultant Mary Anne Marsh, who said she expects a “flood” of women to run for office next year.

“You see this building from the women’s march in January to [Sen. Kirsten] Gillibrand [D-N.Y.] to the Jones win,” Marsh said. “Women are taking control, and that includes politics. You’re looking at a tidal wave in 2018, with the Senate and House poised to be taken over by Democrats if this trend keeps on building.”

Jones repeatedly appealed to women in the closing stretch of the race, courting them on the issue of decency in light of the allegations against Moore, even if they did not share his support for abortion rights. That stance remained an obstacle for him in his outreach to Republicans until the end.

“I want to make sure that when my granddaughters grow up, they don’t have to endure the kinds of things that those girls in Etowah County did and sit silent for 30 or 40 years. I want to make sure that we send a message of who we are and what we are, because we’re much better than that,” Jones said Sunday in remarks at Progressive Union Missionary Baptist Church in Huntsville. He was joined by Rep. Cedric L. Richmond (D-La.), chairman of the Congressional Black Caucus.

Trump allies acknowledged that Jones’s victory was a blow and blamed Republican infighting as much as Moore’s controversies. A key Moore backer, for instance, was former Trump adviser and Breitbart executive Stephen K. Bannon, who is vowing to undercut establishment Republican leaders in Congress.

“You’ve got to have a good candidate and unified party. You can’t have Steve Bannon going one way with Trump and the Republican Senate committee going another way,” said Ed Rollins, an adviser to the pro-Trump Great America Alliance super PAC. “It’s going to make everything more difficult. Everyone is going to start panicking.”

Philip Rucker contributed to this report.