It was supposed to be a race among Democrats to succeed Representative Jane Harman in one of the most Democratic districts in the county.

But a special election in the Los Angeles County district on Tuesday produced an unexpected result: a runoff between a Democrat and a Republican.

Janice Hahn, a Los Angeles city council member, came in first. But her opponent in the July 12 runoff appears likely to be Craig Huey, a Republican businessman who has never held elected office but still finished second out of a crowded field of 16.

With all Tuesday’s ballots counted — there are still vote-by-mail ballots outstanding — Ms. Hahn leads the field with just under a quarter of the votes. Mr. Huey holds a thin lead of just 206 votes over California’s secretary of state, Debra Bowen, with both receiving just over 21 percent of the vote.

Ms. Harman, a Democrat, announced in February that she was retiring from Congress to become president of the Woodrow Wilson International Center for Scholars, a nonpartisan organization that studies national and international affairs.

The race to succeed her is the first for national office in the state since California voters approved an open primary system in the fall, and thus had been closely watched to see how it might change elections in the state. The top two finishers in the primary, regardless of party, move to a runoff if no candidate receives a majority of the vote.

While Ms. Hahn is a popular figure in Los Angeles, Mr. Huey was not nearly as well known, but invested close to $500,000 of his own money in the race.

If Tuesday’s results hold, Mr. Huey will face an uphill battle in this predominantly Democratic district, which stretches from Venice Beach in Los Angeles south to San Pedro. Ms. Harman has held the seat since 2001.

Whoever wins the race will likely face a very different district for a re-election next year, after a nonpartisan redistricting commission redrew the state’s gerrymandered Congressional districts.