Republicans were projected to retain control of the House and Senate after fending off Democratic challenges across the country on Election Day.

Democrats, despite having been optimistic about this year’s chances of retaking the majority in the upper chamber, failed to gain the five seats needed. The Democrats’ candidate beat GOP incumbent Illinois Sen. Mark Kirk, as expected, but the party lost most other tight races. 

As of early Wednesday morning, Republicans were on track to see their 54-46 majority erode only slightly. They could end up with at least 52 seats, according to the AP.

MARIJUANA, ASSISTED SUICIDE MEASURES BACKED BY VOTERS

Republican as expected also kept control of the House. The GOP entered Election Day with a 59-seat House advantage, so Democrats would have had to gain 30 seats to take control of the chamber. They will instead likely pick up 10 to 20 seats, falling short of majority control. 

In the bid to control the Senate, Fox News projected the outcomes of several key races including victories for Republican Sens. Marco Rubio of Florida, Rob Portman of Ohio, Richard Burr of North Carolina, Ron Johnson of Wisconsin, and Pat Toomey of Pennsylvania, all fending off tough challenges to win reelection.

Arizona Sen. John McCain won a sixth term, defeating Democratic Rep. Ann Kirkpatrick in a hard-fought race. Kirkpatrick represented McCain's strongest challenge in years, but his prolific fundraising and name recognition proved difficult to overcome Tuesday. In his victory speech, McCain thanked "my employers, the people of Arizona."

Portman, Burr, Johnson and Toomey were among a handful of incumbent Republicans whom Democrats had targeted early for defeat -- in their bid to win the Senate majority.

“House Republicans won tonight thanks to our members’ relentless focus on the issues important to voters in their districts," said Oregon Rep. Greg Walden, chairman of the National Republican Congressional Committee. 

"Both parties have to work together to find common ground," Portman said in his victory speech. "The best way to do that is to get things done. I’ll do everything in my powers to expand opportunity for everybody.”

The race in Louisiana for the seat of retiring GOP Sen. David Vitter will as expected go to a run-off.

Democrat Foster Campbell and Republican John Kennedy emerged as the top vote-getters in a field of nearly two-dozen candidates. But neither could win more than 50 percent of the vote to win the seat.

The only major race that remained too close to call into Wednesday morning was the Senate contest in New Hampshire between GOP incumbent Sen. Kelly Ayotte and Democratic challenger Gov. Maggie Hassan.

Ayotte is trying to appeal to the state’s notoriously independent electorate while staying loyal to her Washington Republican base and supporters like the National Rifle Association and the billionaire, libertarian-minded Koch Brothers.

Ayotte said early that she’d support Trump but did not endorse him. She then called Trump a “role model,” only to retract the statement after another offensive Trump comment, then totally withdrew her support.

In North Carolina, Burr defeated Democratic challenger Deborah Ross, to serve a third Senate term. And Johnson beat former Wisconsin Sen. Russ Feingold in a rematch of their 2010 race.

In Pennsylvania, Toomey defeated Katie McGinty, a former Clinton administration adviser who was handpicked by Washington Democrats. 

Rubio keeps a Senate seat for Republicans that Democrats had hoped to win after he essentially abandoned the seat for his ultimately-failed presidential bid.

However, Rubio re-entered the race in June and held off a tough challenge from Democratic Rep. Tim Murphy to win a second term.

Republicans also held onto the Senate seat of retiring Indiana GOP senator Dan Coats.

Rep. Todd Young kept the seat by fending off a strong, surprise challenge from former Democratic Sen. Evan Bayh, who muscled into the race in mid-July.  

But in Illinois, incumbent GOP Sen. Mark Kirk was defeated by Democratic challenger Rep. Tammy Duckworth.

Kirk was considered the most vulnerable Republican senator in the 2016 election cycle. Duckworth is a veteran who lost both of her legs in the Iraq War. 

Kirk, a first-term senator who served in Congress for nearly 15 years, was seeking reelection in Democrat-leaning Illinois. He dimmed his comeback chances last month by insulting Duckworth’s Thai ancestry.

“I'm here because of the miracles that occurred 12 years ago ...  … in a dusty field in Iraq,” Duckworth told supporters afterward. “Some I can explain, like the bravery of my crew. And some I cannot, like the shrapnel from the explosion passing through my helicopter spinning rotor blades and not destroy it, allowing us to land. … I live every day trying to honor you.”

Democrats liked their chances of retaking the Senate practically within days of losing the majority in 2014 -- considering they had to defend just 10 incumbents, compared to Republicans who would have to spend far more money and other resources to protect 24 sitting senators.

Republicans had a very short 2016 wish list -- take the seat of arch-political rival Nevada Sen. Harry Reid, the retiring top Senate Democrat.

Republicans had a top-tier competitor in Rep. Joe Heck.

But all of the resources they put into the race couldn't defeat Democratic nominee Catherine Cortez Masto or change the fact that Nevada is a liberal-leaning state anchored by the Las Vegas area, home to a large Hispanic population, which overwhelmingly supports Democratic candidates.  

In Ohio, GOP Gov. John Kasich’s refusal to support Donald Trump made Portman’s task of winning a second term even tougher.

But the state’s older, solidly-white population and a lackluster performance by Democrat challenger and former Gov. Ted Strickland gave Portman the win, after having built a nearly 20-point lead before polls opened Tuesday.

Republicans pulled out a win in Missouri, but it took incumbent GOP Sen. Roy Blunt the political fight of his life. He defeated Missouri Secretary of State Jason Kander, an upstart Democrat with military experience who can assemble an AR-15 blindfolded.

In Indiana, Republicans had a solid candidate in Young, a three-term House member.

But Bayh’s surprise decision to enter the race -- with a $10 million war chest -- made it much more competitive and expensive. 

The race remains surprisingly close until the end, amid disclosures about Bayh’s profitable connections to K Street and Wall Street.

"When I grew up here in Indiana, my dad told me almost every day, 'If I worked really hard, good things would happen.' Well dad, this is a good thing," Young, a former Marine, said after the race. "Tonight was a great victory, not for me, but for the state of Indiana."

Republicans didn’t expect such a hyper-competitive race in North Carolina. But Ross, a former American Civil Liberties Union lawyer and state representative, had little state-wide name recognition.

Toomey's challeger in Pennsylvania was Katie McGinty, among the handful of 2016 Democratic candidates whom political analysts said ran an uninspiring race. The Pennsylvania race was essentially deadlocked since the start of the election cycle.

The Associated Press contributed to this report.