The Virginia election results should shock Democrats into confronting the powerful role that racially coded attacks play in American politics. No candidate would think of entering an election without a winning message on the economy or health care. Yet by failing to counter his opponent’s racial dog whistles, Terry McAuliffe did the equivalent, finding himself defenseless against a strategy Republicans have used to win elections for decades.Crucially, the Republican nominee, Glenn Youngkin, was able to use racially coded attacks to motivate sky-high white turnout without paying a penalty among minority voters. This appears to solve the problem bedeviling Republicans in the Trump era: how to generate high turnout for a candidate who keeps Donald Trump at arm’s length, as Mr. Youngkin did.Before Tuesday night, conventional wisdom held that racially coded attacks could well spur higher white turnout but that those gains would be offset by losses among minority voters. Mr. Youngkin proved this assumption false. He significantly outperformed other Republicans among white voters, especially women: In 2020, Joe Biden beat Mr. Trump among white women in Virginia by 50 percent to 49 percent, but according to exit polls, Mr. Youngkin beat Mr. McAuliffe among them by 57 percent to 43 percent. At the same time, Mr. Youngkin suffered no major drop-off among minority voters — if anything, he appeared to slightly outperform expectations.This should terrify Democrats. With our democracy on the line, we have to forge an effective counterattack on race while rethinking the false choice between mobilizing base voters or persuading swing voters.It will not work to ignore race and talk about popular issues instead. Mr. McAuliffe’s closing message was a generic appeal on infrastructure and other issues that poll well. He was following the strategy known as popularism, which has gained in influence since the 2020 election, when Democrats’ disappointing down-ballot performance was attributed to rhetoric like “defund the police.”In the heat of a campaign, popularism fails because Republicans will not let Democrats ignore race. Mr. Youngkin dragged race into the election, making his vow to “ban critical race theory” a centerpiece of his stump speech and repeating it over the closing weekend — even though in Virginia the prominence of C.R.T., which teaches that racism is woven into the structures of American society, was vastly exaggerated.Some Democrats may resist accepting the centrality of race, pointing to the bearish national political environment and cyclical patterns. This would be a mistake for two reasons. First, C.R.T. helped create the rough national environment, with Fox News hammering it relentlessly; and cyclical explanations, like thermostatic public opinion (a longstanding tendency for voters to drift toward the views of the party out of power on some issues), do not explain Democrats’ loss of support in the suburbs or the strong turnout. Voters in New Jersey, where a stronger-than-expected Republican performance caught Democrats off guard, have been inundated with C.R.T. hype by Fox News, too.Second, the past half-century of American political history shows that racially coded attacks are how Republicans have been winning elections for decades, from Richard Nixon’s “law and order” campaign to Ronald Reagan’s “welfare queens” and George H.W. Bush’s Willie Horton ad. Many of these campaigns were masterminded by the strategist Lee Atwater, who in 1981 offered a blunt explanation: Being overtly racist backfires, he noted, “so you say stuff like forced busing, states’ rights and all that stuff, and you’re getting so abstract.” C.R.T. is straight out of the Atwater playbook.In recent years, it has become commonplace in Democratic circles to think that our diversifying population has relegated such attacks to the past. The theory goes that Democrats can counteract racist appeals by encouraging high turnout among people of color. This interpretation took a ding in 2016 and a bigger hit in 2020, when Mr. Trump shocked many people by making major inroads with Latinos. Latinos recently became the largest population of color, and Democrats cannot win on the national level without winning them by large margins. Yet from 2016 to 2020, Democrats saw a seven-point drop in support among Latinos, according to the Pew Research Center.How did the most racist president of our lifetime outperform a more generic Republican like Mitt Romney with Latinos? Research by Equis Labs suggests that Latinos found Mr. Trump’s populist message on the economy appealing.And as Mr. Trump showed — and Mr. Youngkin confirmed — racially coded attacks do not necessarily repel Latino voters. They may even attract them. One of us, Ms. Gavito, was among the first to flag this disturbing trend. In focus groups in battleground states during the lead-up to the 2020 election, pollsters with Lake Research tested a message that denounced “illegal immigration from places overrun with drugs and criminal gangs” and called for “fully funding the police, so our communities are not threatened by people who refuse to follow our laws.” Both whites and Latinos found this message persuasive, but Latinos found it appealing at significantly higher rates than whites.This, then, is the Democrats’ problem: The fact that Republicans can drag race into the conversation with ease kicks the legs out from under the idea that Democrats can succeed by simply talking about more popular things. And the fact that racially coded attacks spur turnout among white voters without necessarily prompting a backlash among minority voters undermines the idea that mobilizing a diverse electorate can win elections for Democrats.That’s the bad news. The good news is, we know what a path forward looks like.First, Democrats must separate our (accurate and necessary) analysis of structural racism from our political strategy in a country where the electorate remains nearly 70 percent white — and as much as or more than 80 percent white in states like Michigan, Pennsylvania and Wisconsin. Instead of ignoring race while Republicans beat us silly with it, Democrats must confront it and explain that powerful elites and special interests use race as a tool of division to distract hard-working people of all races while they get robbed blind. Then pivot back to shared interests. The pivot is critical: Without it, Democrats are simply talking past voters, while Republicans play on their racial fears.This strategy is known as the “race-class narrative,” pioneered by Prof. Ian Haney López of Berkeley, the author Heather McGhee and the messaging expert Anat Shenker-Osorio (whom we have worked with). To be clear, Democrats should not seek to impose a racial-justice frame; to the contrary, research found a focus on racial justice to be less persuasive than the race-class narrative. The strategy we suggest here is a middle way: It is more powerful than a racial-justice-only frame but also more powerful than a strategy that ignores race altogether. Race is the elephant in the room, and Democrats must stop fooling themselves into thinking that they can prevent it from becoming an issue.Second, Democrats must put aside the false choice between the tactics of persuasion and mobilization and embrace them both. By confronting race as a tool of division, and then pivoting to shared interests, Democrats can offer an optimistic, inspiring and even patriotic vision. This is the approach that rocketed Barack Obama to the White House. As an African-American, Mr. Obama was never allowed to ignore race. Forced to confront it, Mr. Obama offered Americans a vision that mobilized a broad, diverse coalition — while also persuading white voters. In 2008, Mr. Obama won the highest share of the white vote since Bill Clinton in 1996.Race has infused American history and politics since our founding. It threads through most aspects of daily life, and stirs up complicated feelings that Americans of all backgrounds find difficult to discuss. But Virginia showed that race is impossible to ignore.The simple fact is that Republicans have long used race to achieve victory, and Democrats are fooling themselves if they think they can avoid it. Democrats have to get real about race, and forge a way to win.Tory Gavito (@torygavito) is president of Way to Win, a donor network focused on expanding Democrats’ power in the Sun Belt, and lead of the Latinx Justice Fund. Adam Jentleson is the executive director of Battle Born Collective, a progressive strategy organization, a former deputy chief of staff to Senator Harry Reid of Nevada and the author of “Kill Switch: The Rise of the Modern Senate and the Crippling of American Democracy.”The Times is committed to publishing a diversity of letters to the editor. We’d like to hear what you think about this or any of our articles. Here are some tips. And here’s our email: letters@nytimes.com.Follow The New York Times Opinion section on Facebook, Twitter (@NYTopinion) and Instagram. More