Two years after Republican Gov. Chris Christie’s landslide reelection, Democrats in New Jersey won their biggest majority in the state legislature since Jimmy Carter was president. (Mark J. Terrill/AP)

Two weeks before Election Day, the TV screens of New Jersey’s 11th Legislative District glowed with a new negative ad. Republicans Mary Pat Angelini and Caroline Casagrande were under attack.

“Voting records proved they routinely sabotaged women’s health services,” said a frustrated-sounding female narrator in the ad. “They blocked even the most sensible gun-safety measures.”

It worked. Just two years after New Jersey Gov. Chris Christie (R) won a landslide in the state and district, suburban votes ousted the Republicans — and helped boost Democrats to their biggest legislative majority since Jimmy Carter was president.

“Chris Christie’s left a lot of Republican political body bags along the side of the road,” said Michael Muller, a strategist for state Democrats.

The 2015 elections were rougher for Democrats in redder states, as they suffered a surprisingly large defeat in the Kentucky governor’s race, failed to win a majority in the Virginia Senate and saw voters thump an LGBT rights ordinance in Houston. But in blue states and cities, the party held or gained ground. As the parties head into a new presidential year, the country’s partisan divide has deepened. Republicans walked away from Tuesday with the big wins. Democrats walked away with fresh confidence that their map can win a third presidential election in a row.

“It says good things for Hillary Clinton,” said Carolyn Fiddler, communications director of the Democratic Legislative Campaign Committee. “I’m sure she would have preferred it if [Gov.] Terry McAuliffe won a Senate majority for Virginia Democrats, but despite all the money spent there, the status quo continued. The blueness is seeping out from the cities as folks move and settle families. It’s a long-term shift.”

Democrats were not papering over the failure in Virginia, but they were encouraged to see where the blue vote held. The race for the 29th Senate District, centered on Manassas in the Washington exurbs, was one of the year’s most expensive. Democrat Jeremy McPike won it by eight points, thanks to votes from fast-growing, racially diverse Prince William County. Democrats failed to defeat Sen. Richard H. Black (R-Loudoun County), a perennial target, but they cut his margin from 14 points in 2011 to five points Tuesday. The race for an open seat in the Richmond suburbs was even closer, with the Republicans triumphing by 2.7 points in a seat they’d last won by 13 points.

Coverage of that last Democratic loss centered on big ad spending by pro-gun-control groups, which greatly outmatched spending by the National Rifle Association. “Please, please run on gun control,” Republican strategist Chris LaCivita advised Clinton, sarcastically.

But LaCivita, who worked another suburban campaign that went against Republicans, cautioned that the results were close. “What Tuesday showed is that Virginia is still a swing state, an up-for-grabs state,” he said. “We’ve got to draw a message that has crossover appeal to suburban voters.”

Democrats have been counting on winning in 2016 by turning out the growing Democratic electorate, but they have always expected next year to be a fight. Democrats finished Tuesday with confidence that they’d cracked the suburbs. In Colorado, where Democrats lost a 2014 U.S. Senate race after a heavy focus on abortion rights, party activists ousted three members of the Jefferson County school board.

Progressives put recall elections on the ballot after the board members introduced merit pay and challenged history lessons that did not respect “American exceptionalism.” Julie Williams, one of the defeated conservatives, told the Denver Post that “the liberal agenda and union bosses” were responsible for a 28-point landslide against her. But nearly half a million dollars in pro-recall spending was matched — unsuccessfully — by the local branch of Americans for Prosperity, funded in part by the Koch brothers.

In Pennsylvania, another swing state that Democrats include in their 2016 map, the party celebrated a sweep of state Supreme Court elections. That was a break from tradition, of the party’s base staying home in sleepy off-year races. It was enabled by direct mail to Democrats featuring President Obama, a nationalization of the race — and a mirror image of Obama-centric ads that buried Democrats in Kentucky.

“The worry behind this election was that Philadelphia would not turn out, or produce a very low turnout,” said Sen. Robert P. Casey Jr. (D-Pa.), who made nearly a dozen campaign appearances for the Democratic candidates between Halloween and Election Day and who has endorsed Hillary Rodham Clinton for president. “As it turned out, Philly contributed more than 10 percent of the statewide vote. Hillary, who already has a very strong base, can look to that. Her potential in our state is strong because she’ll keep the Philly vote, do well in suburbs, and has a chance to exceed the president’s numbers in western Pennsylvania.”

In an interview, Pennsylvania Republican Party Chairman Rob Gleason pointed to wins in some county and legislative races to argue for a “good night” marred by an “unconscionable” judicial campaign. “We didn’t have a good candidate for mayor in Philadelphia,” he said, “and the unions spent $10 million. Of course that was a problem.”

Urban turnout, a key to Democratic hopes in 2016, was strong enough to notch wins. The party took back city hall in Indianapolis and held it in Charlotte. In both cases, Democratic strategists suggested that they benefited from anger at Republican control, epitomized by Indiana’s bungle of a Religious Freedom Restoration Act.

If applied to 2016, that strategy points to an election fought by inches, on the issues most likely to drive out the base. Clinton, who has built a lead in Democratic primary polling after a shaky summer, has focused on gun control and other base-driving issues to a greater degree than most Democratic nominees. Kentucky, a swing state in both of Bill Clinton’s presidential runs, is off the Democrats’ new map. Colorado’s Jefferson County and Virginia’s Prince William County are decidedly on it. And in New Jersey, Democrats reached out to voters who did not necessarily turn out every election and found the cultural issues that scared them most.

“We discovered that we could treat them like a base voter if we talked in the right way,” Muller said.