Democrats can breathe a sigh of relief: Democrat Janice Hahn won Wednesday’s special House election, holding off self-funding Republican businessman Craig Huey by a 54.6 percent-to-45.4 percent margin.

Hahn, a Los Angeles city councilwoman, will replace former Rep. Jane Harman (D-Calif.), who resigned to become president of a foreign policy think tank.

Her victory is a bright spot on a dark day: Hahn’s mother passed away Tuesday, and she cleared her Election Day schedule to be with her family.

Huey surprised observers on both sides of the aisle by making the race closer than expected. He spent about $1 million in the race, most of it his own money. Hahn spent close to the same amount as Huey, with labor and Democratic groups stepping up with big donations to keep her close financially.

Special elections are known for their low turnouts and can have surprising results, leaving Democrats somewhat nervous about the race. But the district’s Democratic lean was too much for Huey to overcome. Then-Sen. Barack ObamaBarack ObamaReport: Manafort part of intelligence review of intercepted Russian communications Obama staffers challenged to WH scavenger hunt on final day Report: Trump has given up personal cellphone MORE won 64 percent of the district's votes in the 2008 presidential election, and the party has an advantage in voter registration. 

That Huey made the race competitive at all shocked observers, many of whom didn’t expect a Republican candidate in the general election. The race was the first to test California’s newly minted “jungle primary” system, in which candidates from all parties run on one ballot, and the top two vote-getters of any party move on to a runoff if no one wins 50 percent on the first ballot.

Hahn was expected to be in the runoff with fellow Democrat Debra Bowen, the California secretary of state, but they, along with liberal anti-war activist Marcy Winograd, split the Democratic vote in the May primary and Huey slipped by Bowen.

Hahn, whose brother was Los Angeles’s mayor, benefited in the first round of voting from high voter familiarity with her last name, a strong ground organization and a slew of early endorsements from prominent Los Angeles Democrats. Huey spent hundreds of thousands of dollars in the first round to raise his name identification.

But the councilwoman has struggled to unite Democratic voters after a sometimes-nasty primary in which she and Bowen attacked each other on environmental and labor issues. Supporters of the far-left Winograd were less than enthusiastic about Hahn, an establishment candidate.

Labor unions and Democratic groups including President Obama’s Organizing for America stepped in to make sure Hahn held the seat for the Democrats, and former President Bill ClintonBill ClintonHillary Clinton under microscope at inauguration The story of the Trump transition, as told in 57 @RealDonaldTrump tweets Bill Clinton accusers snap picture at Trump gala MORE recorded a robo-call for her in the closing days of the campaign.

Despite his loss, Huey could be in a good position for another run in fall 2012. California’s nonpartisan redistricting commission will likely make the district a bit more conservative before the next election, and his strong performance this year and willingness to spend his own money could make him viable in a general election next year.