Republican Mike DeWine – whom President Trump supported -- defeated his Democratic rival in Ohio's tense gubernatorial race Tuesday, in a win seen as a key midterm victory for the GOP, and perhaps a lesson going into 2020.

DeWine's defeat of Rich Cordray, who once worked under former President Obama as director of the Consumer Financial Protection Bureau, was far from assured. The two had been in a dead heat and DeWine trailed his opponent in early absentee voting. But the Cincinnati Enquirer reported late Tuesday that the lead evaporated by Tuesday night.

DeWine was leading 51 to 46 percent with 92 percent of the precincts reporting.

After his win, the Republican took to Twitter to thank supporters, saying “Let’s get to work.” Cordray sent out a congratulatory tweet to DeWine and thanked his own supporters.

DeWine, who has been in politics for decades, was previously the state’s attorney general. As the campaign wound down, DeWine took a tough-on-crime stand while Cordary’s main focus was on health care.

Trump made a last-minute push in Ohio on Monday and called Cordary, 59,  a "far-left socialist" and "disciple of  Elizabeth Warren,” referring to the Massachusetts Democrat who originally proposed the CFPB. DeWine benefited from the support from Trump and the state’s retiring Gov. John Kasich.

Jane Timken, the Ohio Republican Party chairwoman, told the Enquirer that Trump’s visit helped push DeWine to victory.

"Whenever we see him come into a state, he always gets out the vote," Timken told the paper. "People love those rallies."

Christopher Devine, a professor at the University of Dayton, told the Dayton Daily News that DeWine may have appeared at a rally with the president, but he is not a politician who is a Trump acolyte. He said it "was obvious to anyone paying attention that Mike DeWine is not a big fan of President Trump" and will not govern like a Trump Republican.

"That's an important lesson for other Republicans in Ohio," he said.

The GOP did well in Ohio on Tuesday and swept the ticket on key executive positions, according to the Daily News. Republicans won secretary of state and treasurer, attorney general and auditor.