Wyoming state treasurer Mark Gordon won a fiercely contested GOP primary to replace term-limited Republican Gov. Matt Mead on Tuesday, prevailing over a billionaire businessman who received the last-minute endorsement of President Trump.

Foster Friess, the GOP megadonor who Trump tweeted would be "Strong on Crime, Borders & 2nd Amendment," is a major financial contributer to Christian causes, which analysts had predicted might help him secure Wyoming's religious votes in the race against Gordon and several other candidates.



Trump, who has aggressively campaigned nationally for various state candidates ahead of November's midterm elections, won the state by more than 40 points in the 2016 presidential race. His endorsement has carried significant weight in several primary races this year, helping to oust Rep. Mark Sanford in South Carolina in a stunning upset and keeping Rep. Martha Roby's candidacy alive in Alabama.

But it wasn't enough on Tuesday, as vote tallies showed Friess trailing Gordon by more than six percentage points with virtually all precincts reporting.

It was Wyoming's most contested governor's race since 2010, when Mead beat six others in the Republican primary, and was reported to be one of the most expensive ever conducted in state history. Friess put more than $2 million of his own money into the campaign.

Gordon, having served two terms, was the only Republican running with significant experience in government or elected office. The 61-year-old ranches near Buffalo, Wyoming, and served on the board of the Federal Reserve Bank of Kansas City.

He will face state Rep. Mary Throne, who won the Democratic primary Tuesday, in the general election. Wyoming is among the reddest states, and Gordon is favored to win the general election and become governor.

Gordon is finishing his first full term as treasurer, a job to which he was appointed in 2012.



Meanwhile, Sen. John Barrasso, a vocal supporter of President Trump, fended off a well-funded challenger in Wyoming's Republican primary Tuesday, soundly defeating Jackson Hole business investor Dave Dodson by more than thirty percentage points.

Dodson, who had tapped at least $1 million of his own funds in the race, had advocated for term limits and more action to bring down health care costs.



WATCH: BARRASSO DEFENDS TRUMP, SAYS HE WAS TOUGH ON PUTIN BEHIND CLOSED DOORS

Barrasso for years has been one of the most outspoken advocates of repealing President Barack Obama's Affordable Care Act, an effort that fell just short of passing in the Senate last year.

Barrasso has served in the Senate since June 2007, when he was appointed following the death of Craig Thomas. Barrasso then won a special election in 2008 to complete Thomas' term.

Dodson sharply criticized Barrasso for taking corporate PAC money, though much of his own individual contributions — and Barrasso's — come from out of state.

There were three lesser-known candidates trying to win the Republican Senate race and in an unusual move, one of them bailed from the race Monday afternoon.

Wilson businessman Gary Trauner ran unopposed for the Democratic nomination for U.S. Senate.

Elsewhere in Wyoming, incumbent Liz Cheney won the Republican nomination for the state's lone seat in the U.S. House. Cheney beat two other Republicans in Tuesday's primary: Blake Stanley of Cheyenne and Rod Miller of Buford.

Stanley and Miller both characterized themselves as blue-collar conservatives and ran low-key campaigns.

Cheney is the elder daughter of former Vice President Dick Cheney.

Fox News' Kaitlyn Schallhorn and the Associated Press contributed to this report.