Incumbent Republican Congressman Andy Barr secured re-election in Kentucky’s 6th Congressional District on Tuesday, undercutting Democratic hopes of flipping the seat and enlarging their coming majority in the House of Representatives.

Barr, who has represented the district since 2013, defeated a well-funded challenge from Democrat Amy McGrath. Although recent polling had shown the race to be a toss-up, Barr was declared the winner only a few hours after polls closed, with a final margin of 51 percent to 48 percent.

McGrath, a former Marine fighter pilot, ran a strong campaign highlighting her military record and fiscal conservatism in the Republican-leaning district. The sixth, which is centered around urban Lexington, Ky. and the city's suburbs, has a voter registration advantage that favors the Democrats. But while Democrats edge out Republicans on paper, President Donald Trump carried it on his way to the White House in 2016 by 15 percentage points.

The seat was considered a prime pick-up opportunity by the Democratic Congressional Campaign Committee (DCCC). To that end, the DCCC poured resources and money to bolster McGrath and flip the seat.

McGrath's support from outside groups was essential in her ability to outraise Barr throughout the campaign—pulling in $7.67 million to the incumbent’s $4.78 million—despite being a political newcomer. As denoted by the Center for Responsive Politics, the majority of McGrath’s campaign cash came from outside of Kentucky, while the Barr campaign primarily raised funds from within the state.

In the closing weeks of the race, Barr played up his support for the president and his administration's agenda. During a campaign appearance with Trump in October, the incumbent lauded the president as "a man of action."

"Other people resist, but this president gets results," Barr said. "Mr. President, I’m with you to fight for the American people."