Both Republicans who Donald Trump endorsed won their special congressional elections Tuesday night in North Carolina, delivering the president a symbolic victory as his re-election season gets underway.

The two contests, months in the making, were seen as referenda on whether the president could hold on to majorities in red states that propelled him to the Oval Office.

Republican Greg Murphy won his Third Congressional District handily, holding on to a seat left vacant when Rep. Walter Jones died in February.

The other race, a more hotly contested Ninth Congressional District battle, was a dead heat in the final pre-election polls. But Republican Dan Bishop pulled out a victory by about 2 percentage points.

'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,' Trump gloated on Twitter. '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!'

'BIG NIGHT FOR THE REPUBLICAN PARTY. CONGRATULATIONS TO ALL!' he added, rubbing salt in Democrats' wounds.

North Carolina 9th district Republican congressional candidate Dan Bishop celebrates his victory in Monroe, N.C., Tuesday

The North Carolina Ninth Congressional District special election on Tuesday pitted Democrat Dan McCready (left) against Republican Dan Bishop (right); Bishop won by 2.2 points, a far smaller margin than Trump's 12-point spread there in 2016

The president emerged as Tuesday's victor, as both men he endorsed during a high-profile rally 24 hours earlier won their races

Republican Greg Murphy won the Third Congressional District seat easily, but his race's result was a prelude to the more significant contest that was seen as an indicator of Trump's re-election chances in 2020; Murphy is pictured Tuesday night during a congratulatory phone call with the president

The president boasted on Twitter that Bishop won his race only after he 'asked me for help,' and congratulated the Republican Party for confounding expectations in his race

Trump later piled on CNN and MSNBC, saying the liberal news networks had planned to feature Bishop's race on the air if he had lost – and claiming they would bury it since the Republican prevailed

The president took a second dig during the 11:00 p.m. hour at the two liberal cable news networks that he most often brands as 'fake news.'

'@CNN & @MSNBC were all set to have a BIG victory, until Dan Bishop won North Carolina 09,' he tweeted. 'Now you will hear them barely talk about, or cover, the race. Fake News never wins!'

Trump won the district by 12 points in 2016, suggesting that Republicans' power is fading as his presidency wears on. But a White House official said Tuesday night that 'the president wins wherever he campaigns, and that will be true next year.'

With 99 per cent of the votes counted in the more significant Ninth District race, Bishop was leading McCready by 4,160 votes, a margin of 2.2 percentage points.

Bishop seized on the coincidence of running against another politician named Dan, campaigning with a call to vote for 'Right Dan' instead of 'Wrong Dan,' a pitch he made on stage during a Trump rally Monday night in Fayetteville.

He entered the contest as an outsider after a court invalidated the results of last year's congressional balloting that had appeared to elect a different Republican.

The state ordered a new election on the heels of an official finding that a GOP political operative illegally collected absentee mail ballots for candidate Mark Harris.

Both Republicans who Donald Trump endorsed won their special congressional elections Tuesday night in North Carolina, delivering the president a symbolic victory as his re-election season gets underway

The other race, a more hotly contested Ninth Congressional District battle, was a dead heat in the final pre-election polls. But Republican Dan Bishop pulled out a victory by about 2 percentage points

Dan McCready, the Democratic candidate in the special election for North Carolina's 9th Congressional District, acknowledges cheers from his supporters as he takes the stage to deliver his concession speech with his wife Laura after his loss in the contest, in Charlotte, North Carolina, U.S.

With 99 per cent of the votes counted in the more significant Ninth District race, Bishop was leading McCready by 4,160 votes, a margin of 2.2 percentage points

Dan McCready (R), the Democratic candidate in the special election for North Carolina's 9th Congressional District, speaks with supporters after his loss in the contest

The president congratulated Murphy, a staunch supporter, after his runaway victory

The state board of elections refused to certify Harris's victory, and a judge agreed with them.

Trump relished Tuesday night's first victory while he awaited the results of the second, tweeting his support for Murphy.

'One down, one to go – Greg Murphy is projected to win in the Great State of North Carolina! #NC03,' he wrote.

By night's end he was calling Murphy 'a big winner,' and congratulating him for posting 'much bigger margins than originally anticipated.'

Murphy told a victory party crowd that he would support Trump's priorities in Washington.

'We are here to serve you. We are here to help our president,' he said. 'And we are here to keep America great.'

'Keep America Great' is the president's new slogan for 2020.

Republicans Bishop (top) and Murphy (bottom) had both received support from President Trump and spoke at his Fayetteville rally on the night before polls opened

The Third Congressional District includes most of the North Carolina coast and leans strongly Republican.

Murphy is expected to join the House Freedom Caucus, the most conservative subset of the GOP House minority.

The late Rep. Jones had become a contrarian outsider during his final years in Congress, bucking Trump's demands and siding with Democrats on key votes.

He stood against the GOP House caucus, and against Trump, more than any other Republican member.

Murphy is a urologist who serves in the North Carolina General Assembly.

He defeated Democrat Allen Thomas, the former mayor of Greenville, by more than 24 percentage points on Tuesday.