A longtime Mississippi senator narrowly defeated a rival backed by the small-government Tea Party movement Tuesday, a major win for mainstream Republicans two weeks after they were stunned by the defeat of a top party leader.

Sen. Thad Cochran's victory on Tuesday was the first big test for the party establishment since the No. 2 Republican in the House of Representatives, Eric Cantor, lost two weeks ago to a little-known college professor loosely associated with the Tea Party.

Cochran defeated state legislator Chris McDaniel, who collected more votes than Cochran in the original June 3 primary, but was short of the 50 per cent needed to avoid the runoff. With 99 per cent of precincts reporting Tuesday, Cochran led with 51 per cent to McDaniel's 49 per cent.

Senate Mississippi Chris McDaniel Tea Party

Republican Chris McDaniel, pictured here on a campaign button, had hoped support from the Tea Party and former vice presidential candidate Sarah Palin would help him win a job in Washington. (Associated Press)

Cochran's victory continues a streak of triumphs by mainstream Republican senators over Tea Party challengers. That has been crucial to Republican hopes for winning control of the Senate in the November general election. In the two previous elections, Tea Party candidates defeated more mainstream Republicans in primaries, only to lose to Democrats after being perceived as too radical or unstable.

Mississippi is solidly Republican and probably would have remained in Republican hands even if McDaniel had won. Still, Cochran's victory is likely to comfort mainstream Republicans shaken by Cantor's defeat.

Republican divisions

The race reflected the sharp divisions in Republican ranks, pitting Washington clout against insistence on conservative purity.

McDaniel had the backing of former vice presidential candidate Sarah Palin and the Tea Party movement, which wants to make deep spending cuts and keep taxes to a minimum. He had held up Cochran as the face of an out-of-touch Congress responsible for a blight of federal overspending resulting in a $17 trillion national debt.

The courtly, silver-haired Cochran defended the spending — specifically, the billions in federal dollars he delivered for disaster relief, military bases and agriculture in his home state, one of the poorest in the U.S. He has spent almost half his 76 years in the Senate, including decades on the influential Appropriations Committee which he could chair again if Republicans gain a Senate majority.

Cochran reached out to Democrats

With his political survival at stake, Cochran even reached out to traditionally Democratic voters — blacks and union members. Voters who cast ballots in the June 3 Democratic primary were barred from participating.

The Cochran appeal to non-Republicans infuriated McDaniel and prompted Tea Partyers — as well the NAACP civil rights group and the Justice Department — to keep tabs on the voting in Mississippi. State officials also observed the voting.

In another Republican Senate primary that received less national attention than Mississippi's, an Oklahoma congressman, James Lankford, defeated a Tea Party-backed state lawmaker in a contest for the seat being vacated by a retiring Republican senator. In the solidly Republican state, Lankford is all but assured of becoming the next senator.

Rangel holds steady in New York

Democrats also had a veteran lawmaker vulnerable to a challenge from within his party Tuesday. Congressman Charles Rangel, 84, who has represented Harlem and other parts of New York City for more than 40 years, held a slight lead with nearly all the precincts reporting over Adriano Espaillat, a state lawmaker bidding to become the first Dominican-born member of Congress.

New York Primary Election

Democratic Congressman Charles Rangel, 84, is hoping to hold onto his job, but is facing a tough challenge. (Richard Drew/Associated Press)

​Rangel, a founder of the Congressional Black Caucus, drew criticism last month when he dismissed Espaillat as a candidate whose only accomplishment was to be a Dominican in a majority Latino district. Two years ago, Rangel prevailed over Espaillat in the primary by fewer than 1,100 votes.

In Colorado, a former congressman, Bob Beauprez, won the crowded Republican gubernatorial primary that included another former congressman, Tom Tancredo, a staunch immigration opponent. That was welcome news to national Republicans who feared that Tancredo could have hurt Republican prospects in November's Senate and House races in a state with a large Hispanic voting bloc. The winner will face Democratic Gov. John Hickenlooper.