The state of Colorado made history Tuesday night after voters elected the first openly gay governor.

Democratic U.S. Rep. Jared Polis, 43, defeated Republican state Treasurer Walker Stapleton, keeping the governor's seat in Democratic hands. He succeeds the term-limited John Hickenlooper.

Polis is a five-term congressman and technology entrepreneur who promised to fight for universal health care, renewable energy standards and publicly funded preschool and kindergarten. He vowed to stand up to President Donald Trump's efforts to dismantle former President Barack Obama's health care law.

FULL MIDTERM RESULTS

Stapleton is a two-term state treasurer who campaigned on defending Colorado's constitutional restrictions on taxing and spending. The 44-year-old Stapleton insisted Polis' ideas for funding K-12 education, roads and energy would bankrupt the state.

Republican State Treasurer Walker Stapleton lost against Jared Polis for Colorado's governorship.

Republican State Treasurer Walker Stapleton lost against Jared Polis for Colorado's governorship. (The Walker Stapleton campaign)

Polis had been aware during his campaign that he had a chance to make be a part of a political milestone.

“I think it really gives Colorado an opportunity to stick a thumb in the eye of Mike Pence, whose view of America is not as inclusive as where America is today,” Polis told Colorado Democrats at a speech back in June, according to Vox.

MIDTERM LIVE BLOG

Former New Jersey Governor Jim McGreevey was the first governor to make history back in August 2004 when he came out as gay but he resigned shortly after.

The Associated Press contributed to this story.