The Republican incumbent faced a historic challenge in Mr O’Rourke, an El Paso Democrat who captured the nation with a progressive campaign calling for unity in the reliably red state. However, Donald Trump threw his support behind Mr Cruz, stumping for the conservative senator in the final weeks of the election despite the two previously exchanging insults during the 2016 general elections.
Texas voters told The Independent they had supported Mr O’Rourke due to his progressive policies and calls for uniting a fractured and divided nation, particularly in a state where issues like abortion and gun control are considered taboo.
“I agree with a lot of his positions,” said Haley Smith, a San Antonio resident. “My mom is a resident alien currently, so it’s a strong issue in my family. But I’m also really concerned about our state’s healthcare issue, as I’m a nurse, and it’s very, very important to me that all people can have access.”
Joanne Sylvania, a Texas voter who saw Mr O’Rourke speak during an October rally, said she supported the candidate’s bipartisan messaging.
“I was really taken by the unity,” she said. “And the fact that several times he said: ‘You can be Republican, Democrat, independent, whatever; let’s just work for the nation.’”
Mr Cruz began as the prohibitive favourite after his surprisingly successful 2016 presidential run, but he suddenly found himself in a tough contest against Mr O'Rourke, a little-known El Paso congressman and one-time punk rocker who became a national political sensation and shattered fundraising records despite shunning donations from outside political groups and pollster advice.
The Republican turned back his opponent with the help of Mr Trump, his bitter rival in 2016. The president took the unexpected step of travelling to reliably Republican Texas during crunch time, staging a Houston rally to energize his base for Cruz just two weeks before Election Day.
The president praised the senator as “beautiful” and smart, a far cry from two years ago when he repeatedly mocked Cruz as “Lyin' Ted,” made fun of his wife's appearance and suggested that Mr Cruz's Cuban-born father had a hand in the assassination of John F Kennedy.
For months, Mr Cruz refused to entertain the notion that he'd lose, saying there are more Republicans in Texas than Democrats, so all he had to do to win was avoid conservative complacency. He also said Mr O'Rourke's support for impeaching Mr Trump, relaxing federal immigration policy, decriminalizing marijuana and implementing universal health care were too liberal for even many of the state's moderate Democrats and independents.
Still, the race laid bare that many Texas conservatives never forgave Cruz for clashing with Mr Trump at the end of the 2016 presidential primary and for refusing to endorse him at the Republican National Convention in Cleveland - a move many saw as putting personal ambitions over party.
That's despite Mr Cruz being one of the fiercest supporters of the president and the policies of the Republican-controlled Congress since then, despite getting to the Senate in 2012 as a tea party insurgent intent on enraging establishment leaders from both parties.
Mr Cruz, 47, made no secret about wanting to run for president again once Trump leaves office. And though he was tested by Mr O'Rourke, avoiding what would have been a monumental upset means that remains a possibility.
Mr O'Rourke himself had been mentioned as a possible 2020 White House contender - but that was dependent on him staying within striking distance of Cruz.