In Indiana gubernatorial candidate Lt. Gov. Eric Holcomb (R) thanks supporters after being declared the winner of his race. (Michael Conroy/AP)

Donald Trump’s impressive totals Tuesday helped Republican gubernatorial candidates to victory in Indiana, Missouri and Vermont and put the GOP on track to control at least 32 governor’s offices — matching the modern record.

But the Trump wave didn’t stop a Democrat from winning the governor’s mansion in West Virginia.

As of midnight, Indiana Lt. Gov. Eric Holcomb was declared the winner over Democratic opponent John Gregg, who had once been considered the favorite. In Missouri, Eric Greitens, an ex-Navy SEAL, similarly triumphed over his opponent, Democratic Attorney General Chris Koster.

In Vermont, GOP Lt. Gov. Phil Scott defeated Democrat Sue Minter, the state’s former transportation secretary. And Republicans were in tight battles in New Hampshire and North Carolina.

The evening’s returns exceeded Republicans’ already high expectations. Of the dozen seats up in 2016, they were defending four seats, compared with the eight that Democrats hoped to retain.

Jim Justice speaks to supporters at the Greenbrier Resort in White Sulphur Springs, W.Va., after his victory in the state’s gubernatorial election. (Walter Scriptunas II/AP)

For several cycles, the GOP has run ahead of Democrats in money and organization for state-level races. Republicans hold 31 governor’s mansions, compared with 18 occupied by Democrats. Should Republicans net three more, they will hold as many seats as the record — set in 1922, when Warren G. Harding was president.

“The fears that Trump would harm down-ticket Republicans were proved wrong,” said a GOP consultant who specializes in governors contests. “Republican governors rode the Trump surge tonight to historic gains.”

The rare bright spot for Democrats was the victory of coal magnate Jim Justice in West Virginia. He defeated his opponent, state Senate President Bill Cole, on a night that otherwise saw gains for GOP candidates across the economically distressed state.

West Virginia has trended steadily Republican in recent years, and Trump drew an enthusiastic response from voters there. The GOP, having won control of the state’s House and Senate in 2014, had hoped that Cole would triumph in the governor’s race. But Justice had a strong following that also was boosted by his handling of recent flooding — including opening up the tony resort he owns, the Greenbrier, to homeless flood victims.

The Justice win in West Virginia occurred in part because state residents were willing to split their tickets, a relatively new phenomenon in what once was a reliably Democratic state.

Ticket-splitting also played a role in Vermont, aiding Scott’s race against Minter.

In Missouri, Koster’s lead disappeared in the weeks before Election Day. Greitens gained amid mounting criticism over the cost of insurance premiums under the Affordable Care Act and Democratic nominee Hillary Clinton’s use of a private email server while she served as secretary of state.

As expected, Democrats held on to the governors’ mansions in Washington, Delaware and Oregon. Republicans retained North Dakota and Utah.

Of the seven most heavily contested races, the most expensive and hard-fought were in New Hampshire and North Carolina, both presidential battlegrounds.

In New Hampshire, two state legislators were battling to replace incumbent Democratic Gov. Maggie Hassan, who chose to run for the Senate. The battle between Republican Chris Sununu and Democrat Colin Van Ostern triggered a high-cost ad war in which Van Ostern outspent his rival $6.5 million to $2.5 million. As of just before 2 a.m., the race was still too close to call.

North Carolina was home to the most expensive and closely watched contest, with incumbent Gov. Pat McCrory (R), seeking a second term against popular Democratic Attorney General Roy Cooper. With all precincts reporting, Cooper had a lead of more than 4,000 votes, but both sides said they were prepared for the possibility of a recount.

McCrory had faced headwinds since March, when he signed a law that restricts bathroom rights for transgender individuals and limits some protections for gays and lesbians. But his stock rose last month based on the public’s assessment of how he dealt with widespread flooding from Hurricane Matthew.

A wealthy GOP gubernatorial candidate in Montana hoped to turn things his way Tuesday. Software entrepreneur Greg Gianforte had gone after Democratic incumbent Gov. Steve Bullock by linking him to Clinton and blasting him for not standing against accepting refugees from Syria.

Bullock, the state’s attorney general before being elected in 2012, portrays himself as a champion of public access to federal lands and waterways. He has attacked his opponent for opposing a city ordinance prohibiting businesses from discrimination on the basis of sexual orientation.

Even before the votes were counted on Tuesday, Democrats were looking forward to the 38 gubernatorial races in 2017 and 2018. Of that total, 26 are held by Republicans, noted Jared Leopold, communications director for the Democratic Governors' Association.

“Tonight’s results increase the importance of building the party at the state level,” he said. The party has put a premium on gaining seats in advance of the 2020 census and the redistricting that follows.

Republican gains over the past decade have contributed to huge wins, particularly at the state legislative level.

Democrats have lost 910 legislative seats since President Obama took office.