The Republican National Committee (RNC) said their data helped President Trump determine where to hold Monday-night's Fayetteville rally before Rep.-elect Dan Bishop's victory in North Carolina the next day.

Bishop defeated opponent Dan McCready by 3,937 votes after the RNC made a concerted effort to target Democratic-leaning Trump supporters in two counties. Those included Democratic-leaning Cumberland County, where McCready won by four points in 2018, and where the president held his rally

Bishop secured Election Day voters in Cumberland despite losing absentee and early votes for the county. And while McCready won neighboring Robeson County by 15 points in 2018, Bishop was able to close that gap substantially on Tuesday.

The special election, viewed by some political observers as a bellwether for the president and his 2020 reelection prospects, came after reported voting irregularities in 2018 that eventually prompted a do-over.

DEMS ADMIT TRUMP HELPED GOP CANDIDATES SWEEP NORTH CAROLINA SPECIAL ELECTIONS

RNC Chief of Staff Richard Walters attributed the win to Trump and the party's infrastructure. “Thanks to the best closer in the business, President Trump, and Chairwoman [Ronna] McDaniel’s steadfast commitment to investing in our permanent data and ground-game infrastructure, we knew we had the recipe to put Dan Bishop over the top," he said.

"Our data told us how many voter contacts needed to be made and helped the president make an informed decision about where he should hold his rally. This winning formula will be key for President Trump and Republicans in 2020.”

RNC SURPASSES $20M FOR SECOND STRAIGHT MONTH WHILE ONLINE FUNDRAISING SOARS PAST 2016 LEVEL

National party committees poured $5.8 million into the race, helping Bishop, who had only spent $1.9 million, match the total from Democrats and McCready of roughly $6.1 million.

Both the president's rally and the RNC's spending helped Bishop edge out his victory, according to the Democratic Congressional Campaign Committee (DCCC). "We fell an inch short tonight, but it took more than $6 million in outside Republican spending and a last-minute Trump rally," DCCC Chairwoman Cheri Bustos said.

The RNC's victory came as it ramped up its ground game with data-intensive efforts before the 2020 elections. In North Carolina, the RNC placed 20 full time staffers, had 500,000 direct contacts with voters, and made heavy investments in digital and online ads.

CLICK HERE TO GET THE FOX NEWS APP

Fox News' Mark Meredith contributed to this report.