COLUMBIA, South Carlina — One of President Donald Trump's earliest and most loyal supporters won a key runoff Tuesday as South Carolina Gov. Henry McMaster fended off a challenge from a self-made millionaire to secure the Republican gubernatorial nomination.

The vote tested the heft of Trump's endorsement in South Carolina, where McMaster, 71, was elevated to the governorship he'd long sought early last year following the departure of Nikki Haley to serve as the U.S. ambassador to the United Nations.

As lieutenant governor, McMaster was the nation's first statewide elected official to back Trump, ahead of South Carolina's early presidential primary.

McMaster — a former state attorney general and U.S. attorney who was elected lieutenant governor in 2014 — has had the last year and a half to develop the mantle of an incumbent. He's tallied up economic development announcements and championed issues aligned with the president's priorities, such as clamping down on so-called sanctuary cities and restricting funding for groups affiliated with abortions.

In November's general election, he'll seek a full term for the office that eluded him in 2010, when he lost a four-way primary to Haley in his first bid for governor.

Congratulations to Governor Henry McMaster on your BIG election win! South Carolina loves you. We are all proud of you and Peggy! @henrymcmaster — Donald J. Trump (@realDonaldTrump) June 27, 2018

Tuesday's runoff threatened to embarrass the White House if McMaster fell short to first-time candidate John Warren. Warren, a businessman who largely self-funded his effort, argued that he was more similar to Trump than McMaster was.

Trump and Vice President Mike Pence visited the state in recent days to campaign for McMaster. At a rally in West Columbia on Monday night, Trump pointed to his frequent nemesis, the news media, and warned that a loss for McMaster would be portrayed as a defeat for him.

He followed up the rally with a sunrise tweet telling voters that McMaster "will never let you down."

It was great being with Governor Henry McMaster last night in South Carolina. Henry is tough on Crime and Borders, loves our Military and our Vets and has created many jobs and a great economy. GO OUT AND VOTE FOR HENRY TODAY, HE WILL NEVER LET YOU DOWN! — Donald J. Trump (@realDonaldTrump) June 26, 2018

Trump has a mixed track record when going all-in for candidates. His preferred candidates have recently lost in Alabama and Pennsylvania.

Two weeks ago, McMaster was the top vote-getter in the Republican gubernatorial primary but failed to get the majority he needed to win the nomination outright.

In November, McMaster faces Democratic state Rep. James Smith, who won his primary outright.