Texas Republican Ted Cruz and Democratic challenger Beto O’Rourke clashed in a series of sharp exchanges Tuesday night in the second and possibly final debate of their closely watched Senate race.

The two, locked in an unexpectedly tight race in deep red Texas, sought to seize the momentum in heated skirmishes about guns, taxes, immigration, and most significantly, core Texas values that they both claim to represent.

Both staked out familiar positions that made their differences plain on issues like the Republican tax cuts, which O’Rourke called a deficit-funded “giveaway to the rich,” and Democratic proposals for universal health care, which Cruz called “socialized medicine.”

One of the leading questions going into Tuesday’s debate was whether O’Rourke would be more aggressive toward Cruz, who has seen a bump in some recent polls since their first debate last month in Dallas, when Cruz was often on the attack.

For subscribers: Beto O’Rourke’s ties to his wealthy family draw scrutiny, and attack ads

O’Rourke was quick with an answer: “He’s dishonest,” O’Rourke said in response to Cruz’s charge that he favors a $10 a barrel tax on oil. “That’s why the president called him Lyin’ Ted. And that’s why the nickname stuck. Because it’s true.”

O’Rourke took the first shot in the debate when he attacked Cruz for paying more than $5 million for political services from Cambridge Analytica, the data firm that accessed private information from 50 million Facebook users to influence voters in the 2016 presidential election.

“The very company that helped to undermine our democracy,” said O’Rourke, who also blasted Cruz for failing to stand up to President Donald Trump: “He won’t stand up to him, and he won’t stand up for us.”

Cruz faulted O’Rourke for votes against special tax benefits for victims of Hurricane Harvey and for votes that he said would effectively result in a $10 a barrel tax on oil. “That would have been absolutely devastating to the state of Texas,” Cruz said.

He called O’Rourke’s record on energy and in favor of abortion rights “extreme.” He also repeatedly criticized O’Rourke for saying he would be open to impeaching Trump, a move that Cruz said would lead to a “political circus.”

O’Rourke reminded viewers of Cruz’s role in a 2013 government shutdown over funding for the Affordable Care Act, which O’Rourke supports. “It’s really interesting for you to talk about a partisan circus, after your last six years in the U.S. Senate,” O’Rourke said, to laughter in the small studio audience.

Tuesday’s debate took place less than a week before early voting in the midterm election begins Oct. 22.

The Cruz campaign took note of O’Rourke’s more aggressive posture. “When you’re down 10, you better do something, right?” said Cruz campaign manager Jeff Roe.

One more debate?

It was to be the third debate in the nationally watched race. But the second, scheduled Sept. 30 in Houston, was canceled when it appeared that Cruz would be tied up in the Senate’s confirmation process for Supreme Court Justice Brett Kavanaugh.

Behind the scenes, the two campaigns have continued to negotiate another potential debate Thursday as part of a previously scheduled CNN town hall in McAllen. After a joint town hall fell through, O’Rourke accepted an invitation to appear separately, along with a rally headlined by Los Tigres del Norte, a popular norteño group.

Cruz, turning down CNN’s invitation for his own separate town hall, proposed Sunday that the town hall in McAllen be formatted as a debate.

“If we are going to spend an hour on national cable news discussing and debating the issues important to Texas voters, we believe it should be on a stage with our opponent,” Cruz campaign manager Roe wrote to Mark Preston CNN, executive director of political programming.

For O’Rourke, Tuesday’s encounter was a chance to build on the momentum of his monstrous fundraising, which has seen him raise more than three times as much as Cruz over the past three months. The El Paso congressman’s $38.1 million was the largest fundraising quarter ever for a U.S. Senate race — all raised without the help of political action committees.

Related: Beto O’Rourke tops $60M, obliterating Texas campaign finance record

Cruz, who raised a still-hefty $12 million over the same period, has been buoyed by a series of polls showing him with a consistent lead over O’Rourke, reflecting Texas’ historically conservative orientation.

Most recent polling in the race has given Cruz a high single digit lead, with the average margin going into Tuesday’s debate favoring the Republican incumbent by 7 points, according to Real Clear Politics. Nevertheless, the Cook Political Report recently moved the Senate race’s rating from “Lean Republican” to “Toss Up.”

Like Republicans across the nation, Cruz has sought to rally the GOP base in the aftermath of the Kavanaugh confirmation battle, arguing that it “underscored the stakes” in the election. He accused Senate Democrats of “smearing” Kavanaugh.

O’Rourke, who opposed Kavanaugh’s nomination, questioned Cruz’s record on other judicial nominations, noting that he had promoted the nomination of Circuit Court Judge Jeffrey Mateer, who has called transgender children part of “Satan’s plan.”

Cruz has sought to portray himself as the target of a national effort to reorient Texas politics. “Every left-wing radical in the country wants to turn Texas blue,” he told supporters at a recent rally leading up to the debate in San Antonio. “And they are sending their money to Comrade Beto.”

Much like in their first debate — when Cruz labeled O’Rourke’s agenda as “socialism” — Cruz used Tuesday’s debate to paint his Democratic opponent as a leftist in the mold of Vermont Sen. Bernie Sanders.

“I want to cut your taxes, and Congressman O’Rourke wants to raise them,” he said. He also criticized O’Rourke for opposing “Kate’s Law,” legislation Cruz sought to increase penalties on immigrants caught repeatedly crossing the border illegally.

“Look, all you’ve heard from Senator Cruz is what we should be afraid of,” O’Rourke said in Tuesday’s debate. “It’s a campaign based on fear… I want to bring people of Texas together.”

Despite his past rivalry with Trump, Cruz is banking on a boost from the White House next Monday when the president holds a long-promised rally for Cruz and other Texas Republicans at the NRG arena in Houston.

Some Texas Democrats see Trump’s arrival as a sign of GOP concern about Texas, where a Democrat hasn’t been elected to statewide office since 1994. A defeat for Cruz, no matter the odds, would be both historic and far-reaching for Republicans nationally.

Cruz closed out the hourlong debate defending Trump and the Republicans’ control of Congress. “Elections are about choices. Do we continue the path that we’re on, or do we turn back?” Cruz said. “I want to keep the economic boom we’re experiencing right now moving forward.”

kevin.diaz@chron.com