Sen. Gary Peters, D-Mich., fended off a serious challenge from two-time GOP Senate hopeful John James in the swing state of Michigan.

Peters, who got his start in politics 30 years ago and faced plenty of tough races before, pulled off a nailbiter of a victory late Wednesday, Fox News projected.

"I am sincerely honored that the voters of Michigan have once again put their trust and confidence in me to represent them in the United States Senate," Peters, a former congressman and state and local lawmaker, said in a statement. "As we look ahead, I am energized to keep working to move our state forward and continue putting Michigan first."

REPUBLICANS WIN KEY SENATE RACES, FIGHT TO KEEP MAJORITY FROM DEMS

Peters' race was called shortly after Fox News projected Democrat Joe Biden had won Michigan, delivering a huge boost for his White House bid. The double Democratic wins put Michigan back to the blue column after President Trump's surprise upset here four years ago.

Sen. Gary Peters, D-Mich., speaks at a rally for Democratic presidential candidate former Vice President Joe Biden and former President Barack Obama at Northwestern High School in Flint, Mich., Saturday, Oct. 31, 2020. (AP Photo/Andrew Harnik)

Peters, 61, was one of two Democratic senators up for reelection in states that Trump carried in 2016. The other, Sen. Doug Jones, already lost his race in Alabama to former college football coach Tommy Tuberville. 

Early vote counts initially showed Peters, a former Navy reservist, lagging substantially behind James, but with 98 percent of the vote counted, the first-term senator was ahead by 60,000 votes: 49.6% to James' 48.51%. 

Trump, who already filed a legal challenge to the vote counting in Michigan, cast doubts about the Michigan Senate race results earlier in the day.

"Wow! It looks like Michigan has now found the ballots necessary to keep a wonderful young man, John James, out of the U.S. Senate," Trump tweeted. "What a terrible thing is happening!

James' general consultant, Stu Sandler, declared victory at noon Wednesday, tweeting that "Michigan elected it's first Black Senator." As the vote totals were updated throughout the day, Sandler raised concerns about irregularities and the lack of transparency at the Detroit ballot counting location.

Chaos broke out at the TCF Center in Detroit earlier Wednesday when police prevented more poll challengers from entering the room to observe ballot counting because of overcapacity. The Detroit News reported that both Democrats and Republicans had surpassed the law-mandated maximum of 134 challengers, and when election workers told GOP challengers the party had hit its limit, some began shouting and police had to intervene by locking them out. 

The heated Senate race came down to the wire between Peters and James, a combat veteran and a rising star in the Republican Party.

Peters pitched himself as a bipartisan bridge-builder who gets real results for Michigan behind the scenes, in contrast to his charismatic and TV-ready opponent.

Billing himself as a "workhorse" versus a showhorse, Peters embraced his unflashy persona. He said he didn't get into politics to soak up the spotlight and he hoped Michiganders will appreciate someone who just rolls up their sleeves and worked across the aisle for results. 

WHO IS GARY PETERS? 7 THINGS TO KNOW ABOUT THE MICHIGAN SENATOR

James, an Iraq combat veteran and Detroit businessman, entered into politics a few years ago and did better than expected by mounting a competitive run against Sen. Debbie Stabenow, D-Mich. Stabenow beat James in 2018 by about 6 points, 52% to 46%.

CLICK HERE TO INTERACT WITH FOX NEWS VOTER ANALYSIS

Republicans were optimistic that James was poised to do better Tuesday and defy the odds by flipping the seat red. Michigan hasn't elected a Republican to the Senate since 1994. James would have been the first Black senator from Michigan in history.

In this combination of 2018 and 2019 file photos are, from left, Democratic U.S. Sen. Gary Peters, D-Mich., and Republican U.S. Senate candidate John James. Money is abundant in Michigan's competitive U.S. Senate race between Peters and James. A campaign-finance expert projects spending will top a staggering $100 million by Election Day. (AP Photos, File)

CLICK HERE TO SEE FOX NEWS’ LIVE PROBABILITY DIALS

James, 39, campaigned with Trump Monday as the president sought to repeat his Michigan magic from four years ago. Trump has called James a “star” and previously considered nominating him as U.S. ambassador to the United Nations.

James depicted Peters as an "invisible" career politician who has skipped congressional hearings and hasn't delivered for Michigan.

James said the race was a contest between a "career politician versus a combat veteran."

WHO IS JOHN JAMES? 7 THINGS TO KNOW ABOUT MICHIGAN'S SENATE CANDIDATE

Peters, a strong proponent of the Obama Administration's 2008 auto rescue for General Motors and Chrysler, got an assist from former President Barack Obama, who cut an ad for Peters in Michigan.

"Gary was there every step of the way -- helping save the auto industry, protecting the Great Lakes, covering pre-existing conditions," Obama said. 

TOP BATTLEGROUND SENATE RACES TO WATCH ON ELECTION DAY

Health care had been an issue in the race, with James criticizing Peters for getting health care coverage from a Michigan legislative retirement program rather than signing up for ObamaCare. Meanwhile, James took heat for wanting to repeal ObamaCare but not offering a concrete solution and in one interview suggesting that his replacement involves "having healthier Americans."

With the control of the Senate on the line, money poured into the race. The Peters-James face-off was expected to top $100 million in spending, making it the most expensive election in Michigan's history, according to the Michigan Campaign Finance Network.

Peters holding onto the Senate seat was a relief for Democrats trying to erode the GOP majority in the Senate. Democrats already lost a Senate seat in Alabama, as expected, but failed to flip competitive seats in Maine, Montana, Iowa and elsewhere. 

Peters' win means that Democrats will have at least 48 seats heading into next year, with four Senate races still undecided.