LAGUNA BEACH, Calif. — Democrats breathed sighs of relief Wednesday as party candidates in California’s seven most competitive House races were set to advance to the general election and go on the offensive in those Republican-held districts, all of which Hillary Clinton carried in 2016.
National Democratic groups spent more than $7 million this spring as part of an extraordinary intervention to avoid being locked out of Tuesday’s “top two” California primary, in which the two leading vote-getters — regardless of party — move on to the general election this fall. Democrats were virtually certain to secure a slot in the general election against Representative Dana Rohrabacher, a Republican, and in the Southern California districts held by Representatives Ed Royce and Darrell Issa, who are retiring. House Democrats had staged a rescue mission in all three districts, by propping up their own favored candidates, attacking Republicans or a mix of both.
Democratic Party leaders were, however, caught by surprise in the Central Valley district of Representative Jeff Denham, a Republican who easily won a place on the general election ballot. In the competition for the second spot in November, a Democrat was leading a little-known Republican candidate by less than a thousand votes.
While 100 percent of the precincts were reporting vote counts in each of the contested districts, The Associated Press had not yet declared the top two finishers in some races because absentee ballots are still trickling in and the gap between second and third place was narrow. But in key races, Democrats had sufficient margins to be poised to advance to November.
There may be no state more crucial to Democrats’ hopes for taking back control of the House than California. If Democrats were to win each of the seven Republican-held districts Mrs. Clinton carried, the gains would amount to nearly a third of the 23 seats they need overall to flip the House.
Here is a look at the results in those seven districts:
39th Congressional District
Young Kim, a Republican assemblywoman in this Orange County-based district, secured a spot in the general election in November. She will face a Democrat, Gil Cisneros, a Navy veteran whom national Democrats spent heavily to help in a crowded primary race.
Democrats have high hopes in this increasingly diverse district now that veteran Representative Ed Royce is retiring. Republicans, though, are optimistic that their Korean-American nominee positions them well in an Irvine-area district that is filled with Asian and Hispanic voters.
The Democratic Congressional Campaign Committee endorsed Mr. Cisneros in April and spent $2 million promoting him and attacking Republicans to keep their vote share down.
And last month, state and national Democrats brokered a détente between Mr. Cisneros and another party candidate, Andy Thorburn, after weeks of increasingly negative attacks between the two, who spent at least $6 million of their own money on the race. In the end, though, Mr. Cisneros significantly outpaced the other Democrats in the field, winning about 9,000 more votes than his closest party rival, Mr. Thorburn.
48th Congressional District
Mr. Rohrabacher was the top vote-getter in his Orange County district, while Democrats Harley Rouda and Hans Keirstead were locked in an extraordinarily close race for the second slot. As of early Wednesday afternoon, Mr. Rouda had just 73 more votes than Mr. Keirstead with all precincts reporting but some late ballots still to be tabulated.
Both Democrats had about 1,000 votes more than Scott Baugh, a Republican, who had aimed to deny Democrats a chance to take on Mr. Rohrabacher in November.
Mr. Rouda claimed victory early Wednesday but Mr. Keirstead deemed the race “too close to call.”
National Democratic groups spent heavily on the race to avoid a shutout, unleashing a series of attacks on Mr. Baugh and promoting Mr. Rouda.
With his vocal support for Russia and a trail of controversial comments, Mr. Rohrabacher could be among the most vulnerable House Republicans in California this fall. Democrats in his affluent, Seal Beach-to-Laguna Beach district have been organizing against him for over a year.
49th Congressional District
Republican Diane Harkey was the leading vote-getter in the seat currently held by Mr. Issa and appeared likely to face a Democrat, Mike Levin, in the general election.
Ms. Harkey, a former assemblywoman, ran far ahead of any other Republican in the field. Mr. Levin, an environmental attorney, had a lead of nearly 2,000 votes ahead of another Democrat, Sara Jacobs, in a seat that stretches from Camp Pendleton south to La Jolla.
Democrats nearly captured this affluent district in 2016, when Mr. Issa won by fewer than 2,000 votes. With Mr. Issa retiring, the seat will be one of the Democratic Party’s top targets in November.
Mr. Levin, a former executive director of the Democratic Party of Orange County, raised less money than Ms. Jacobs, but he benefited from building a solid political organization after entering the race early in 2017, ahead of some of his rivals.
National Democrats did not get behind any candidate in this race, but they did broadcast ads to drive down support for Assemblyman Rocky Chavez, a Republican. Mr. Chavez will likely finish in a distant sixth place.
But Ms. Jacobs was not ready to concede Wednesday morning, saying in a statement that “it’s important that every vote be counted, and we’re going to allow that process to continue.”
10th Congressional District
Representative Jeff Denham, a Republican, was the top vote-getter and will likely face a Democrat, Josh Harder, a venture capitalist in this heavily agricultural district of the San Joaquin Valley.
But for much of the night Tuesday, Democrats were alarmed that they might be locked out of the November general election. Mr. Harder was narrowly leading a Republican candidate, Ted Howze, by about 900 votes.
Mr. Harder, raising close to $1.5 million, had more money to campaign with than all the other Democratic candidates in the primary combined. But Mr. Harder was at risk of being denied a slot on the November ballot because the other five Democrats in the race split more than 30 percent of the vote. National Democrats had spent little money attempting to ensure they advanced a candidate into the general election.
The district encompasses a wide swath of the San Joaquin Valley, dominated by almond farms, and has been represented in Congress since 2013 by Mr. Denham. But it is not just farms that dominate economic life in the district: There is a large industrial base and warehouses dot the area, and the district also includes a sliver of populous areas that serve as bedroom communities to the Bay Area and could offer Democrats hope in November.
21st Congressional District
With no Republican challengers to Representative David Valadao and only one Democrat — T.J. Cox, a businessman — on the ballot, the outcome of this race in the Central Valley was not much in question.
Mr. Valadao, a Republican, has represented this district in California’s Central Valley since 2013, and is seeking a fourth term. Of the seven California districts currently represented by Republicans that Mrs. Clinton carried, Mr. Valadao may be among the most difficult to beat.
Even as Mrs. Clinton was carrying the district with over 60 percent of the vote, Mr. Valadao easily won re-election.
And while the district is over 70 percent Latino, Democrats have found it more difficult to turn out Hispanic voters in nonpresidential years.
Mr. Cox, though, will have ample funding: He had over $440,000 as of last month.
25th Congressional District
Representative Steve Knight, a Republican in his second term, took the top spot in this Los Angeles County-based district, while Democrat Katie Hill appeared poised to claim the second slot on the November ballot.
Ms. Hill, who runs a nonprofit helping homeless people, was leading another Democratic candidate, Bryan Caforio, by more than 1,500 votes on Wednesday. She was lifted by Emily’s List, the Democratic women’s group, over Mr. Caforio, who ran against Mr. Knight in 2016.
Mr. Knight is seen as one of the most at-risk House Republicans in California because of his changing district.
A former Los Angeles police officer who served for years in the California Legislature before winning a seat in Congress, Mr. Knight represents a piece of northern Los Angeles and Ventura Counties. The area had been reliably conservative, but a growing Hispanic population has raised hopes among Democrats that it can be flipped.
Mrs. Clinton won the district by nearly seven points and Democrats outnumber Republicans among registered voters.
45th Congressional District
Representative Mimi Walters, a Republican in her second term, was the top vote-getter in this Orange County district. She will face a Democrat, Katie Porter, who is a consumer advocate and law professor.
A strong progressive candidate, Ms. Porter was propelled by key endorsements from Senators Kamala Harris of California and Elizabeth Warren of Massachusetts, as well as Emily’s List.
In her career in California’s Legislature and in Congress, Ms. Walters has proved resilient. And she has nearly $1.6 million on hand.
But Ms. Porter is likely to draw deep support from her allies in the national party in a district Mrs. Clinton carried by more than five points and that is increasingly made up of Asian and Hispanic voters.