— Although Republican Gov. Pat McCrory and Democratic Attorney General Roy Cooper remain locked in a tight race for governor, Cooper declared victory early Wednesday.

"We have won this race for governor of North Carolina," Cooper said at a North Carolina Democratic Party gathering in Raleigh. "It has been a long, long journey to get to this point, and I know that people waited in long lines to vote and to allow their voice to be heard. I am humbled by that. Thank you so much."

Cooper's speech miffed Republicans.

"Despite Roy Cooper's rude and grossly premature declaration of victory, under the laws of the state of North Carolina, this election is not over and will not be over for some considerable amount of time," state Republican Party Chairman Robin Hayes said. "There are outstanding provisional, mail and overseas ballots, not to mention serious concerns about the issues in Durham County."

At about 11:45 p.m., a large bloc of early votes from Durham County was added to the state totals, putting Cooper on top after trailing McCrory for several hours.

With 100 percent of precincts reporting, Cooper was only 4,500 votes ahead of McCrory, according to unofficial results. Lon Cecil, a Libertarian, had 2 percent of the vote.

"The race is not over in North Carolina," McCrory told a cheering crowd at a state Republican Party gathering in Raleigh. "We're going to check everything. We are going to make sure every vote counts in North Carolina."

He said he doesn't expect the final results to be known until counties hold their official canvass of votes in 10 days.

"We've got to let the process work, and we have to respect the election system," he said. "We are going to fight for every vote between now and Nov. 18."

"The results won’t be finalized tonight, but Cooper enters North Carolina’s canvass process with a strong lead," state Democratic Party Chairwoman Patsy Keever said in a statement. "With provisional ballots, Attorney General Cooper stands poised to grow his lead in a recount and become North Carolina’s next governor."

Economy, HB2 shaped race

McCrory and Cooper began posturing themselves to run against one another in 2013. But it wasn't until May 2015 that Cooper declared he would seek to unseat the governor.

Through the past two years, the two have traded barbs over a wide range of policies. Cooper has criticized McCrory as unwilling or unable to stand up to a too-conservative General Assembly. McCrory has shot back that Cooper hasn't done his job as attorney general, frequently turning to outside law firms to defend policies such as a 2013 election law that is still in the courts.

McCrory built his campaign on his so-called "Carolina Comeback," pointing to more than 300,000 new jobs and a dipping unemployment rate.

"If we're unsuccessful recruiting a company, the No. 1 reason is the lack of talent," McCrory insisted.

But Cooper argued that the state's rebound from the recession is mainly on paper.

"You go talk to everyday working people, and most of them will tell you they haven't seen one yet because they're working longer and harder for less money than they were before the recession," he said. "I measure success as more money in the pockets of working, everyday people."​

House Bill 2, the controversial state law on transgender rights, also was a key issue in the campaign.

McCrory has steadfastly supported House Bill 2, saying it blocks a federal effort to redefine gender and protects women and girls in bathrooms and locker rooms from sexual predators.

The law notably requires transgender individuals to use the bathroom in schools and other public buildings that correspond to their birth gender while allowing businesses to set their own rules for bathroom access. But the law also sets a statewide nondiscrimination policy that excludes the LGBT community.

Cooper has been critical of McCrory, saying that House Bill 2 is discriminatory, has cost the state millions of dollars in economic growth and ought to be repealed. But McCrory pointed to job expansions and data suggesting the law has not hurt North Carolina's economy.

"As governor, I'll put partisan politics aside so we can turn around our economy and fix our schools. No more social legislation that divides our state and hurts our reputation," Cooper said in his final ad push.