Sen. Ted Cruz, R-Texas, won re-election to the Senate by defeating Rep. Beto O'Rourke, D-Texas, Tuesday night in what became one of the highest-profile political fights of the 2018 midterm elections.

Cruz, the former 2016 GOP presidential candidate, defeated O'Rourke, who became a celebrated figure for Democrats nationwide after climbing in the polls versus the conservative Republican and his prolific fundraising ability — headlined by his $38 million third-quarter haul — throughout the cycle.

[CLICK HERE for complete midterm elections coverage and results]

However, he was unable to get through Cruz, the polarizing Republican, who spent much of the past two and a half years rehabbing his image back home after losing the 2016 GOP nomination to Trump and his initial decision not to endorse the eventual president.

Cruz worked hard since Trump won to become a player within the Senate GOP conference, specifically working on the party's tax bill that passed last December and the push to repeal and replace the Affordable Care Act rather than his previous role as a thorn in their side for the previous four years.

The work paid off. Cruz was supported by many previous foes, including Trump, who campaigned for him in Houston in the waning weeks of the campaign, Senate Majority Leader Mitch McConnell, R-Ky., and Sen. John Cornyn, R-Texas, who Cruz had some bad blood with dating back to his election to the Senate in 2012. The pair of senators both fundraised for the Texas Republican, while Cornyn also campaigned alongside Cruz in the final weeks on the trail.

Throughout the campaign, the two locked horns on a number of issues, namely immigration and the economy. O'Rourke staked out a number of progressive positions that Cruz's team was able to exploit, namely O'Rourke's call to impeach the president and backed the government-run "Medicare for All" plan Sen. Bernie Sanders, I-Vt., has championed.

Despite O'Rourke's rise, Cruz remained the favorite throughout the race, largely due to Texas' continued standing as a rock-solid Republican state. Helping matters for Cruz was Texas Gov. Greg Abbott's position atop the GOP ticket and his massive re-election victory Tuesday night. Ultimately, those factors hurt O'Rourke, who many Republicans believe ran a great campaign, but was never unable to win in Texas — the pre-eminent Republican state on the map.

"He's got plenty of talent. He's got more than enough cash," said one GOP strategist back in October after O'Rourke announced his third-quarter fundraising figures. "But what he never had was a chance."

Those institutional advantages were key for Cruz to finally beat O'Rourke, who is being floated in some circles as a 2020 candidate despite the loss. He has said multiple times that he will not run for the Democratic nomination in 2020.

According to the final RealClearPolitics average, Cruz led by a 6.8-point margin over the Democratic congressman.