Eric Cantor, the majority leader in the US House of Representatives, has lost his Virginia seat to a Tea Party challenger in a Republican primary upset.

Cantor, the second most senior Republican in the House, was easily beaten on Tuesday by David Brat, a college economics professor who accused Cantor of betraying conservative principles on spending, debt and immigration.

The result could halt efforts to write a House immigration reform bill, if nervous Republicans decide to protect themselves against future challenges from the right before the November 4 mid-term elections.

It could also make Republicans even more hesitant to cooperate with President Barack Obama and Democrats for fear of being labelled a compromiser.

Lindsey Graham, Republican senator from South Carolina, also faced a Tea Party challenge on Tuesday, but he beat a crowded field of six challengers who also had accused him of not being conservative enough.

With 99 percent of precincts reporting, Graham, 58, had about 56 percent of the vote, far more than what was needed to avoid a run-off.

South Carolina Senator Lee Bright came in second, with about 15 percent.

No good fortune

Graham, who has been in office since 2002, had a huge fund-raising advantage: He has raised more than $12m since his last re-election bid in 2008, while none of his opponents passed the $1m mark.

Although Graham had no trouble dispatching his Tea Party challengers and their attacks that he was not conservative enough, other longtime Republican politicians have not had such good fortune.

In Mississippi, Senator Thad Cochran is facing a run-off with Tea Party-backed state Senator Chris McDaniel later this month after both finished just shy of the 50 percent of votes needed to win outright.

Virginia's Cantor had been seen by many as an eventual successor to House Speaker John Boehner, and his defeat will mean a shake-up in the Republican leadership at the end of the year among House members nervous about the depth of public anger towards Congress.

A seven-term congressman with ties to the financial industry, Cantor had spent more than $5m to head off the challenge from Brat, a political newcomer who teaches at Randolph-Macon College.

Brat spent only about $122,000, according to the Centre for Responsive Politics, and was not seen in the media or national Republican circles as a danger to Cantor.

The victory also emboldened conservative leaders, and could encourage a challenge to Boehner when the new leadership team is chosen.

With nearly all precincts reporting, Brat had about 56 percent of the vote to Cantor's 44 percent.

"I know there are a lot of long faces here tonight," Cantor told supporters. "It's disappointing, sure."

Immigration issue

Brat said: "This is the happiest moment, obviously, of my life."

During the primary campaign, Brat repeatedly accused Cantor of supporting some immigration reform principles, including "amnesty" for undocumented workers.

In response, Cantor had sent voters a mailer boasting of his role in trying to kill a House immigration bill that included that provision.

Brat also accused Cantor of losing touch with his central Virginia district while serving the party's leadership.

It was unclear if Cantor intended to remain in his leadership post for the duration of the year, and who might replace him in the new Congress if Republicans hold their majority.

Elsewhere, Republican Senator Tim Scott won his primary by a wide margin, setting the stage for South Carolina to elect a black person to the US Senate for the first time.

Scott was appointed to the seat in 2012 after Senator Jim DeMint stepped down, and the general election winner will serve the remainder of DeMint's term.