HOUSTON — Ted Cruz, an insurgent backed by the Tea Party, easily defeated the candidate favored by Gov. Rick Perry on Tuesday in a runoff election for the Republican Senate nomination that revealed a wide rift in Texas between the party establishment and restless anti-incumbent activists on the right.


With the come-from-behind victory over Lt. Gov. David Dewhurst, Mr. Cruz is heavily favored to win the Senate seat being vacated in November by Kay Bailey Hutchison and appears likely to become a star of the national conservative movement.


“We did it,” Mr. Cruz told the cheering crowd gathered at a Marriott Hotel in Houston to claim victory. “Millions of Texans, millions of Americans are rising up to reclaim our country, defend liberty and restore the Constitution.”


Mr. Cruz, 41, is the latest conservative rebel to bring down an established party leader, tapping into frustration within the Republican ranks nationwide. These dissident triumphs include, in this year’s primaries, the defeat of Senator Richard G. Lugar of Indiana by Richard E. Mourdock and Deb Fischer’s win over a veteran Republican for the Senate nomination in Nebraska. They also echo Marco Rubio’s Senate victory in 2010 over a Republican governor, Charlie Crist of Florida.


“I love it,” said Ken Yowell, 69, a retired businessman who came with his wife to Mr. Cruz’s victory party, their first time ever at a political event. “We need some conservative Christians in office,” he said, and someone who will fight for the economy and against abortion.


Mr. Cruz, who is Cuban-American, has drawn comparisons to Mr. Rubio, another youthful Cuban-American who quickly became an icon of fiscal and religious conservatives around the country. Mr. Cruz’s rapid ascent has already shaken up the Texas Republican Party, in a race watched as a test of the enduring strength of the Tea Party and its stringent antitax, antigovernment themes.


“Mr. Cruz’s success shows that the center of the state party has moved decisively to the right,” said James Henson, a political scientist at University of Texas. “The Republicans are in much more treacherous terrain, not because of threats from Democrats, but threats from within the party.”


A Harvard-trained lawyer, a former Washington official under President George W. Bush and the former solicitor general of Texas, Mr. Cruz had argued cases before the Supreme Court but never before run for office. He turned out to be a natural campaigner, and with his implacable opposition to big government, he won the enthusiastic support of Tea Party activists in Texas and around the country.


Mr. Dewhurst, 66, a wealthy rancher and businessman, has held the powerful elected post of lieutenant governor for nine years and was endorsed by Mr. Perry and most other top party leaders as well as business and farm groups. Mr. Dewhurst will continue as lieutenant governor.


Mr. Dewhurst has a deeply conservative record, and often during the campaign the two candidates seemed to mimic each other on the issues, with both vowing to repeal President Obama’s health care law, cut spending, get tough on the border and fight abortion.


But Mr. Cruz relentlessly portrayed his opponent as a creature of the establishment who is too quick to compromise.


In an Election Day appearance before a small but revved-up crowd outside a polling station in Houston, Mr. Cruz gave credit to his thousands of fervent on-the-ground volunteers. “We’re here today because of the grass-roots organizing,” he said.


“We’ve spent 18 hours a day crisscrossing Texas, going to IHOP and Denny’s, listening to the voters, asking for their support one by one,” he said. “That’s how democracy is supposed to be.”


With indications that an upset was likely, Tea Party celebrities including Sarah Palin, Senator Jim DeMint of South Carolina, Glenn Beck and Rick Santorum came to speak on Mr. Cruz’s behalf over the last several days.


The Club for Growth, a conservative pro-business lobby based in Washington, spent $5.5 million on television ads for Mr. Cruz. FreedomWorks, a national advocacy group closely allied with the Tea Party and led by the former House majority leader Dick Armey, sent money and campaign trainers.


“We’re looking for activist, involved, creative conservatives who take more initiative to see things through,” Mr. Armey said of the group’s choice of Mr. Cruz.


At his victory speech, Mr. Cruz thanked the lieutenant governor for his service and for calling to offer his support, and he called for Mr. Dewhurst’s followers to forget the harsh words of the campaign and join together.


One Texan who jumped into the grass-roots Cruz campaign was Maggie Wright, a self-described retired housewife and grandmother from Burleson, outside Dallas, who had traveled here to cheer on her candidate on Election Day. Since December, she had been a volunteer, distributing signs and bumper stickers provided by FreedomWorks.


“We don’t want a go-along, get-along senator,” she said, waiting for Mr. Cruz to appear at the polling site. “We want a fighter who will draw a line in the sand.”


Mr. Dewhurst attacked Mr. Cruz as inexperienced and beholden to out-of-state pressure groups and Washington insiders.


“I’m a lifelong businessman and the only true conservative in the race,” he said at a final appeal to voters in a Houston deli.


One of Mr. Dewhurst’s supporters, Dr. Gary Brock, a pediatric surgeon in Houston, said that Mr. Cruz was too inexperienced at governing. “The Democrats tried a charismatic Harvard-trained attorney with no record and it hasn’t worked out too well for the country,” he said.


But in the end, in a contest that depended largely on who could turn out the greatest number of voters on a sweltering summer day, it was the passionate legions behind Mr. Cruz who prevailed.


Mr. Cruz, who led by 11 percentage points with 75 percent of returns counted, is expected to have a large advantage over his Democratic opponent. In the Democratic runoff, also held Tuesday, former State Representative Paul Sadler defeated Grady Yarbrough, a retired educator. Texas has not elected a Democrat to the Senate since Lloyd Bentsen in 1988.