EL PASO, Tex. — Senator Ted Cruz, Republican of Texas, won re-election on Tuesday in one of the tightest midterm races in the country, defeating the best-financed and most popular Democrat to run in Texas in years, Representative Beto O’Rourke.
Mr. Cruz’s narrow victory did more than dash Democratic hopes that the party could capture a Senate seat in Texas for the first time since 1988. It promised to restore Mr. Cruz’s standing as a far-right force in American politics, after many leaders in his own party questioned whether he was likable enough to run successfully against a candidate like Mr. O’Rourke, an El Paso congressman known for his charisma.
“This was an election about hope and about the future, and the people of Texas rendered a verdict that we want a future with more jobs and more security and more freedom,” Mr. Cruz told hundreds of supporters at a Houston hotel ballroom.
Mr. O’Rourke appeared before his supporters shortly after 10 p.m. Blocks from the United States border with Mexico, at a minor-league baseball stadium in his hometown, El Paso, Mr. O’Rourke stepped onto a concert stage and said he had spoken to Mr. Cruz and congratulated him on his victory.
“I’m as inspired, I’m as hopeful as I’ve ever been in my life, and tonight’s loss does nothing to diminish the way I feel about Texas or this country,” he said, later stepping off the stage as John Lennon’s “Imagine” played on the loudspeakers.
Republican strategists and insiders said Mr. Cruz’s narrow victory did not mean that Democrats stood to make substantial gains in Texas. Rather, they believed it had more to do with Mr. Cruz himself, one of the most divisive political figures in the state, and the anti-Trump energy of Democrats.
Pivotal factors in the tightness of the election results were the Republican and independent voters who voted for Mr. O’Rourke but also cast ballots for top Republicans in other races. Gov. Greg Abbott, a Republican whose views are in line with Mr. Cruz’s but whose style is far less abrasive, easily won re-election, and a sizable number of Republicans appeared to have split their votes for Mr. Abbott and for Mr. O’Rourke.
“It was political nitroglycerin from the minute this campaign started,” said Ted Delisi, a Republican political consultant in Austin who was Senator John Cornyn’s chief campaign strategist in 2002. “Beto O’Rourke couldn’t have run this race against John Cornyn. He couldn’t have run this race against Greg Abbott. This race had to be run against Ted Cruz, and it had to be run this year. This was the once-every-20-years opportunity.”