Republican Larry Hogan won the Maryland governor’s race Tuesday night, a stunning upset in one of the country’s deepest-blue states.

The victory over his Democratic opponent, Lt. Gov. Anthony Brown, makes Hogan only the second GOP governor in Maryland in the past five decades.

Brown served eight years under Gov. Martin O’Malley and was the frontrunner from the start.

However, he was continually challenged by Hogan, a businessman and son of a congressman, about the O’Malley administration’s steady stream of tax increases.

“I don’t think Brown ever got out from under that,” Robert L. Ehrlich Jr. the state’s last GOP governor, told Fox News.com early Tuesday. “And Larry had such message discipline.” 

Washington reporters thought the race would in large part be about the state’s failed rollout of the ObamaCare exchange, of which Brown was in charge.

But the issue was not a big part of the Hogan campaign’s attack line and was never important to voters in Maryland, where Democrats outnumber Republicans 2-to-1.

Ehrlich, who won the Maryland governorship in 2002, said the issue was never relevant, except that it perhaps showed Brown wasn’t ready to run a state government.

Brown had led the race by double digits from the start. But late polls -- including one by The Baltimore Sun in mid-October that indicated Brown ahead by just 7 percentage points -- showed his lead starting to slip.

The turning point seemed to occur after a Republican-sponsored poll released last week showed Hogan trailing Brown by just 2 percentage points, 46-to-44 percent.

“The timing is perfect,” Hogan told Fox News last week. “There’s a full-scale tax revolt in deep-blue Maryland.”

In the closing weeks, the respected Cook and Rothenberg political reports both re-evaluated the race and put Brown on shakier ground. And at the same time, Hillary Clinton campaigned for Brown and New Jersey Gov. Chris Christie, chairman of the Republican Governors Association, campaigned in Maryland twice for Hogan.

President Obama, who took nearly 62 percent of the Maryland vote in 2012, also campaigned for Brown.

Hogan spokesman Adam Dubitsky suggested last week that Maryland Democrats were taking Hogan too lightly, pointing out that Brown, a Harvard law school graduate who served in Iraq, said during his tough primary race that winning the general election would just be “a little bit of a mole hill.”