Republican Sen. Ted Cruz fended off a very tough challenge from Democratic Rep. Beto O'Rourke in one of the most highly anticipated midterm election races of the year.

O'Rourke and Cruz presented Texas voters with a stark choice on both policy and personality.

Republican Sen. Ted Cruz fended off a very tough challenge from Democratic Rep. Beto O'Rourke in one of the most highly anticipated midterm election races of the year in a state that hasn't sent a Democrat to the Senate in 25 years.

O'Rourke, a 46-year-old El Paso Democrat, was fueled by over $60 million in campaign donations, a savvy social-media strategy, and a series of glowing national media profiles — and generous comparisons to President John F. Kennedy.

O'Rourke raised more money than any Senate candidate in history, bringing in a shocking $38 million in the third quarter alone.

For months, he's attracted widespread national attention with viral video clips of him defending the free speech rights of NFL players and live streams of his road trips across the vast state. The attention came with celebrity endorsements from the likes of country music star Willie Nelson and NBA legend LeBron James.

O'Rourke and Cruz presented Texas voters with a stark choice on both policy and personality.

Cruz — a gun-toting, cowboy boot-wearing evangelical Christian — has developed a reputation in Washington for his sharp elbows and lofty ambitions.

Republican Sen. Lindsay Graham once quipped that "if you killed Ted Cruz on the floor of the Senate, and the trial was in the Senate, nobody would convict you." Meanwhile, O'Rourke has framed himself as an affable former punk rocker with a knack for connecting with millennials.

Read more: Republicans projected to hold on to majority control of the Senate

The race was defined by a bitter fight over immigration. Cruz aligns with President Donald Trump on building a border wall, opposes a path to citizenship for so-called DREAMers, and backs the president's call to end birthright citizenship.

US Senate candidate Rep. Beto O'Rourke, a Texas Democrat. Chip Somodevilla/Getty Images

O'Rourke supports a path to citizenship for the undocumented, spoke out against Trump's family-separation policy, and has, more controversially, advocated for demilitarizing the Immigrations and Customs Enforcement Agency.

In a recent spat, Cruz attacked O'Rourke's campaign for using $300 of campaign funds to buy basic supplies for an El Paso charity that provides shelter and assistance to immigrants.

The two also advocated diametrically opposed positions on issues like healthcare, gun control, and the environment.

Cruz, who rode the Tea Party movement into the Senate in 2012, leaned into his hardline conservative credentials in an attempt to energize the GOP base and even called in back-up from the president, whom he famously called a "pathological liar" during the 2016 Republican primary.

O'Rourke, who ran on a staunchly progressive positions including supporting Sen. Bernie Sanders' Medicare for All proposal, impeaching Trump, and defanging ICE, also depended on unprecedented enthusiasm — and anger — among the Democratic base.

LIVE UPDATES: Follow our live coverage of the 2018 midterm elections here.

While some strategists argued that O'Rourke's unapologetically progressive platform helped him deepen Texas' Democratic base, others believe he ceded territory to Cruz by alienating centrist voters and Republicans disillusioned by Trump.

But O'Rourke did attempt to balance his progressive platform with aggressive outreach to independent and Republican voters, frequently joking on the stump that he had persuaded his mother, a "lifelong Republican," to vote for him — and that he would appeal to many more Texans like her.

Unlike Cruz, O'Rourke has banned donations from corporate political action committees, making the size of his campaign war chest even more impressive.

In a sign of unprecedented energy in Texas, early voter turnout exceeded the state's total turnout in the 2014 midterm elections — and nearly reached presidential year levels.