Democrat Conor Lamb is the apparent winner of a House seat in Pennsylvania’s Trump country by a razor-thin margin, an upset that gives Democrats a boost as they try to take control of Congress later this year.

At around 5:30 a.m. ET, NBC News reported that it appeared that Lamb had won. The only outstanding votes are the approximately 200 absentee votes in Greene County, it said, and the provisional ballots that the district will count within the next seven days. Even with those added to the count, it does not appear that rival Rick Saccone can catch up. NBC News noted it was possible that there may be a recount ordered.

Lamb, a 33-year-old former prosecutor and Marine veteran, was expected to narrowly beat Republican Rick Saccone in Tuesday’s 18th District special election. Pro-GOP groups poured money into the race to avoid a loss that may shake up November’s battle for control of Congress.

With the expected win, Democrats get confidence they can compete or win in some red House regions carried by Trump in 2016. The president won the district by about 20 percentage points. Democrats have gotten confidence from a consistent lead in surveys asking voters if they would support a generic Republican or Democrat for Congress.

The party outperformed 2016 results in multiple pro-Trump areas in House special elections last year, but failed to win any of them. But Democrats can count Lamb’s projected victory, combined with Democratic Sen. Doug Jones’ win in deep-red Alabama last year, as a least a moral victory heading into the midterms.

Pennsylvania’s soon to change congressional map makes the longer-term effect of the election less clear. Because the state’s districts will change, Lamb would only represent the district he won for a few months. He would not run in November as an incumbent, but instead have to challenge Rep. Keith Rothfus, R-Pa., in the new 17th District.

Still, in anticipation of a likely Lamb run in the district in November, elections handicapper Sabato’s Crystal Ball changed its rating on Rothfus’ seat to “toss-up.”

Polls showed momentum for Lamb in the final days of the special election race. His campaign had raised more than four times the money Saccone’s did, though the GOP got a hand in the form of more than $10 million in spending from outside Republican groups.

Initially, Republicans tried to damage Lamb by hitting him for opposing the GOP tax plan and tying him to House Democratic Leader Nancy Pelosi. But as Lamb refused to support Pelosi, both of those angles failed to resonate with voters.

Lamb tried to make his campaign about local issues, pledging to protect Social Security and Medicare for the region, fight the opioid crisis and protect the rights of labor unions.

Nationally watched special elections can help the winning party spark more enthusiasm, recruit candidates or raise money. For instance, Republican Scott Brown’s victory in a special Senate election in Massachusetts in 2010 was seen as a boost to the GOP, which picked up seats in Congress that November.

On the other hand, losing a bellwether election can potentially deter talented candidates from running for office or donors from contributing.

The Pennsylvania district opened up when Rep. Tim Murphy, R-Pa., resigned last year under a cloud of scandal. Murphy won every election there from 2002 to 2016, and no Democrats even challenged him in his last two victories.

Pennsylvania’s 18th is the type of district Democrats hope to win if they have a chance of winning control of the House in November. It has typically supported Republicans and is better educated, wealthier and better employed than the median congressional district.

Democrats need to gain 24 seats in the midterms to take a majority in the House.