For months, Republicans in Virginia insisted the coalition of voters who helped reelect President Obama in the state last year was unlikely to show up for an off-year state election without the president’s name on the ballot.

They were wrong, helping lift Democrat Terry McAuliffe to a narrow win over Republican Attorney General Ken Cuccinelli II for governor.

Black voters, who voted last year in historically high numbers to show support for the nation’s first black president, came out again to support McAuliffe this year, according to exit-poll data. African Americans composed about 20 percent of the electorate — the same proportion as 2012.

Latino voters, a growing portion of the Virginia electorate, also came out to the polls in a similar percentage compared to last year.

Women — whom McAuliffe pursued with a relentless ad strategy designed to portray Cuccinelli as hostile to issues they cared about — backed McAuliffe by nine points, matching Obama’s lead with women last year and eclipsing Obama’s seven-point lead in 2008.

When Terry McAuliffe was elected governor of Virginia Tuesday night, it was the latest indication the state might slightly favor Democrats. (The Washington Post)

And as with Obama last year, Northern Virginians backed the Democrat, giving McAuliffe the win in Fairfax, Loudoun and Prince William counties, each of which had supported Republican Robert F. McDonnell for governor four years ago.

The last two presidential elections have shown the GOP’s vulnerabilities in attracting minority voters, young people and single women. But voting among those groups has traditionally dropped off in non-federal years.

If Democrats have cracked the code on how to drive them to the polls in those years, too, they could create an enduring electoral strategy that could spell trouble for Republicans over time.

The result is likely to fuel an ongoing debate within the Republican Party about how to appeal to a changing electorate.

“What it shows is that it’s the voter identification and contact strategy that’s working,” said Quentin Kidd, a political science professor and pollster at Christopher Newport University. “This is the first statewide race in Virginia where the Obama model is really being applied. It shows what Democrats can do with it.”

That coalition meant the percentage of voters who identified themselves as Democrats was nearly as high this year as it was for the presidential election last year. Nearly four in 10 voters identified as Democrats in exit-poll results for the Virginia governor’s race. Just over three in 10 identified as Republicans or independents.

McAuliffe performed well with women, buoyed by a concerted effort to publicize Cuccinelli’s conservative views on abortion and his support for a bill in the General Assembly that Democrats said could have outlawed some forms of birth control.

Still, that outcome was not predetermined.

When Virginia elected McDonnell in 2009, who also opposes abortion, women supported the Republican by eight points over Democratic state Sen. R. Creigh Deeds.

But since then, Republicans in Virginia’s General Assembly pushed stringent new regulations for abortion clinics and a measure to require women to receive ultrasounds before receiving an abortion.

State Sen. Ralph S. Northam (D-Norfolk), who was elected lieutenant governor Tuesday, pointed to the issue in his acceptance speech. “No group of legislators, most of whom are men, should be telling women what they should or shouldn’t do,” Northam said to loud cheers.

In Arlington County, Stephanie Chong, 39, said she has become more interested in politics since Obama ran for office in 2008, voting for the first time in a statewide election this year. She voted for McAuliffe alongside her 5-year-old daughter, Elli, affixing a “Future Voter” sticker to the girl’s jacket.

“She knows that it’s important we vote because women didn’t always have the right to vote,” Chong said. “Democrats are more for women’s rights, and I definitely appreciate that.”

Democratic Del. Scott A. Surovell, who represents a Fairfax district that is heavily Latino and African American, said he was surprised by the intensity of the passion among voters Tuesday.

He said he watched as two African American voters confronted a Republican poll worker at one voting place. “Why does your party not want me to vote?” Surovell recalled one of the voters saying.

“There’s just a lot of lingering hostility and resentment among people feeling like they’ve been picked on and isolated,” he said, noting Republican efforts in Richmond to tighten voting rules.

In Prince William County, ­Pedro Delcid and his wife, Rosa, both immigrants who fled a civil war in El Salvador and settled in Northern Virginia more than two decades ago, said they had heard about Cuccinelli’s position on immigration on Spanish-language television and couldn’t stay home Tuesday.

“This man was talking bad about our people,” said Pedro Delcid, 40, owner of a small remodeling company in Manassas. “This is the one issue that brought me here today.”

Rosa, 32, said, “We are voting for what’s best for Virginia and what’s best for our people.”