Dan Bishop beat Democrat Dan McCready and two other candidates Tuesday in the 9th Congressional District, which has been held by Republicans since 1963.
The race was seen as a measure of popularity for Trump, who campaigned for Bishop on Monday in Fayetteville. Trump won the district by 12 points in 2016; however, the district was drastically redrawn in 2017 (and will likely be changed again before the next election).
TIMELINE: On the day of the 9th District Special Election, a look back at how we got here
Early returns showed Dan McCready with a narrow lead over Republic Dan Bishop in the District 9 Special Election, but as more votes came in Bishop made up ground and eventually surpassed McCready. Bishop ended up winning by nearly 4,000 votes or approximately 2 percent of the vote.
VIEW ELECTION RESULTS HERE.
Bishop, 55, a state senator best known for the North Carolina law dictating which public bathrooms transgender people can use, tied himself closely to Trump, even getting the president to come to the state and rally for him ahead of election day.
Trump took to Twitter after the victory to take credit for bringing the district home for the Republican party.
Dan Bishop was down 17 points 3 weeks ago. He then asked me for help, we changed his strategy together, and he ran a great race. Big Rally last night. Now it looks like he is going to win. @CNN & @MSNBC are moving their big studio equipment and talent out. Stay tuned!— Donald J. Trump (@realDonaldTrump) September 11, 2019
The results in the district underscored the rural-urban split between the parties, with Bishop running up substantial numbers in outlying areas and McCready eroding GOP advantages in suburban areas. McCready's moderate profile resembled that of many Democrats who won in Republican-leaning districts in the 2018 midterms and, even with the loss on Tuesday, showed the durability of that approach.
"I think it means Trump is going to get a second term, and Republicans will retake the majority," House Minority Leader Kevin McCarthy, R-Calif., said in an interview with The Associated Press. Many analysts think a GOP takeover will be difficult.
Special elections generally attract such low turnout that their results aren't predictive of future general elections. Even so, the narrow margin in the GOP-tilted district suggested that Democrats' 2018 string of victories in suburban districts in red states including Texas, Oklahoma and Kansas could persist next year.
RELATED: 7 arrested in connection to 9th District absentee ballot fraud investigation
Rep. Cheri Bustos of Illinois, who runs House Democrats' political committee, said the close race showed her party is "pushing further into Republican strongholds" and was in a "commanding position" to do well next year.
Michael Bitzer, a politics professor at Catawba College in North Carolina, said the narrow margin suggests that the country's other closely divided swing districts "could be still up for grabs."
There is almost no pathway to Republicans regaining House control next year unless they avoid losing more suburban districts and win back some they lost last year.
The district stretches from Charlotte, one of the nation's financial nerve centers, through its flourishing eastern suburbs and into less prosperous rural counties along the South Carolina line. More than half its voters were expected to come from the suburbs.
Since Trump became president, voters in such communities - particularly women and college-educated voters - have abandoned Trump in droves over his conservative social policies and vitriolic rhetoric on immigration and race.
Suburban defections would also jeopardize the reelection prospects of Trump, who's already facing slipping poll numbers. Limiting the erosion of those voters will be crucial for him to retain swing states like North Carolina, which he won by less than 4 percentage points in 2016.
But Tuesday's vote showed that Bishop benefited from the district's conservative leanings.
"Bishop, his policies follow my convictions - after hearing Bishop, knowing that he's for the Second Amendment and he's against illegal immigration," said Susie Sisk, 73, a retiree from Mint Hill. The registered Democrat said she voted for Bishop.
Along with a GOP victory in a second vacant House district in North Carolina, Republicans pared the Democratic majority in the House to 235-199, plus one independent. That means to win control of the chamber in 2020, Republicans will need to gain 19 seats, which a slew of GOP retirements and demographic changes around the country suggests will be difficult.
In the day's other special election, Republican Greg Murphy, a doctor and state legislator, defeated Democrat Allen Thomas - as expected - to keep a House district along North Carolina's Atlantic coast.
That seat has been vacant since February, when 13-term GOP Rep. Walter Jones died, and Trump won the district handily in 2016.
The bathroom law that Bishop sponsored was repealed after it prompted a national outcry and boycotts that the AP estimated cost North Carolina $3.7 billion.
Bishop bound himself tightly to Trump, backing his proposed border wall with Mexico and accusing Trump critics of being intent on "destroying him."
"The voters said no to radical, liberal polices pushed by today's Democratic Party," Bishop said in a victory speech.
McCready, a former Marine who started a firm that's financed solar energy projects to cast himself as a job creator and environmental champion. He also focused on containing health care costs and ran a spot featuring his trademark promise to prioritize "country over party."
In his concession speech, McCready referred to the ballot fraud investigation that led to Tuesday's special election.
"The people of North Carolina stood up and we faced down the full force of election fraud and voter suppression," he said. "When the people in power sought to silence the voices of the voters, stole their ballots, forged signatures from them, filled in vote choices for them . we fought back and we won."
At a rally Trump staged for Bishop in July, Trump said four Democratic women of color should "go back" to their home countries, though all but one was born in the U.S. The crowd began chanting "Send her back!"