After a long night of drama, Lamb holds a 627-vote lead over Republican Rick Saccone. With 100% of precincts reporting, Lamb recived 113,813 votes, or 49.8% of the vote, to Saccone's 113,186 (49.6%).
There are some remaining votes to be counted, however, including provisional and any military or overseas ballots, which may currently still be in the mail but must be received by the counties by March 20.
Republicans have not ruled out the possibility of a recount, which isn't mandatory for the district but could be requested by precinct with petitions from voters in the next few days.
Lamb claimed victory in a speech to his supporters Tuesday night.
"It took a little longer than we thought, but we did it," he said. "You did it."
Bob Branstetter, a top adviser to Saccone's campaign, told CNN Wednesday morning that the campaign has not discussed a potential recount. But, he said, they are waiting for all votes to be counted before reaching a decision on conceding.
Matt Gorman, a spokesman for the National Republican Congressional Committee, said the party is not ruling out the possibility of a recount, and a source familiar with the process told CNN Wednesday morning that the GOP is likely to seek legal action over several areas in this race.
The party is going to request that all ballots and voting machines are impounded so nothing is tampered with to allow for a likely recount, the source said. They allege reports of "miscalibrations" of several voting machines in Allegheny County, including frozen touchscreens where voters intending to cast their ballot for Saccone were only presented with Lamb. The party also accuses the Allegheny County election board of not letting Republican officials into the room where absentee ballots were being counted.
The party also said that the Pennsylvania's secretary of state website confused voters by noting new district lines set to take effect in November following the state Supreme Court's order to redraw districts, the source added. Branstetter also said that the campaign received some calls from voters who were confused about whether they could still vote in the 18th District after the Pennsylvania Supreme Court's decision.
Allegheny County spokeswoman Amie Downs disputed the party's claims, saying the machines don't show photos and that they received no calls related to "miscalibrations" during voting hours Tuesday. She also noted that the county's confirmation screen on voting machines allows voters to change their vote or give them time to call a poll worker to report an issue. She acknowledged that a person lacking authorization to be in the room where absentee ballots were being counted was blocked from entering, but was later allowed back in when the person was approved to be there.
And Wanda Murren, a spokesperson for Pennsylvania's secretary of state, said polling places will not change under the new map provided by the state Supreme Court.
It's a bad sign for Republicans that the 18th District race is razor-tight. Trump won there by 20 percentage points in 2016, and GOP groups pumped $10.7 million into a months-long effort to stave off an embarrassing loss there. Lamb's performance is ominous for the GOP as it heads into November's midterm elections.
Even a narrow Lamb win would signal that the GOP is in danger even in districts considered safe for Republicans, raising Democratic hopes of capturing the House and maybe the Senate in November. A Republican loss could lead to more House members retiring rather than running into headwinds in re-election bids. Democrats, meanwhile, would look to replicate Lamb's success in working-class districts with similar demographics.
With no declared winner, both parties took a stab at spinning the available results. The Democratic Congressional Campaign Committee claimed victory for Lamb in a statement Tuesday night, while the National Republican Congressional Committee said it was "confident" Saccone would win.
Earlier in the evening, before it became clear the results would be so close, several Republican officials told CNN they were expecting Saccone to lose. Party officials were placing the blame squarely on Saccone's campaign but also on Trump's Saturday rally for the candidate, which some Republicans believe helped drive up Democratic turnout.
When the race tightened, that outlook improved, with one GOP source telling CNN's Jim Acosta: "This isn't a blowout -- for now, we'll happily take it."
A Republican official told CNN that Trump, who was raising money with GOP donors in Beverly Hills, California, had been asking for updates throughout the evening and was pleasantly surprised by the narrow margin.
Lamb and Saccone were running to replace former GOP Rep. Tim Murphy, who resigned after allegedly urging a woman with whom he was having an affair to have an abortion.
The stakes are largely psychological: Pennsylvania's Supreme Court recently ruled that its congressional districts were gerrymandered and redrew the map -- meaning both candidates would face choices about where to run if they want to be on the ballot in November.
CNN's Adam Levy, Jennifer Agiesta, Jeff Zeleny, Rebecca Berg and Jim Acosta contributed to this report.