RICHMOND, Va. — House Majority Leader Eric Cantor lost in his Republican primary election Tuesday to a little-known economics professor, a stunning upset for the No. 2 Republican in the House and a major victory for the ultraconservative tea party movement.

Cantor, viewed as a possible successor to House Speaker John Boehner, was taken down by a political novice with little money named Dave Brat. His win marked the biggest triumph this year for tea party supporters who until a few years ago backed Cantor, a former state legislator who rose to Majority Leader in 2011.

Much of the campaign centered on immigration, where critics on both sides of the debate have recently taken aim at Cantor. Brat accused Cantor of being a top cheerleader for "amnesty" for immigrants who are living in the U.S. illegally. Cantor responded forcefully by mailing out fliers boasting of blocking Senate plans "to give illegal aliens amnesty."

It was a change in tone for Cantor, who has repeatedly voiced support for giving citizenship to certain immigrants brought illegally to the country as children. Cantor and House Republican leaders have advocated a step-by-step approach, rather than the comprehensive bill backed by the Senate. They've made no move to bring legislation to a vote and appear increasingly unlikely to act this year.

Cantor conceded the race with his wife, Diane, at his side.

"Obviously we came up short," Cantor told glum supporters at a suburban Richmond hotel. "Serving you as the 7th District congressman and having the privilege of being the majority leader has been the highest honor of my life," added Cantor, who is the most prominent Jewish Republican leader.

Jay S. Poole, a Cantor volunteer, said Brat tapped into widespread frustration among voters about the gridlock in Washington and issues such as immigration. "I can't tell you how amazing this is to me," Poole said.

Brat's message apparently registered with voters in Virginia's 7th District, which is in the Richmond area.

Brat had been a thorn in Cantor's side throughout the campaign, casting the congressman as a Washington insider who isn't conservative enough. Last month, a feisty crowd of Brat supporters booed Cantor in front of his family at a local party convention.

"If I had my way, I wish everybody in Congress and the Senate would be gone and we would start fresh," said Brat voter Henry Moriconi, 70, of Henrico County, who expressed frustration that Congress has been unable to confront issues such as the federal deficit.

Brat, he said, is "the right person for the job."

The tea party movement advocates deep spending cuts to reduce the federal deficit, but opposes tax increases to boost revenue.

Brat's supporters gathered Tuesday night in the lobby of a suburban Richmond office park and cheered as the widely unexpected results began to arrive. Brat made the rounds among a crowd of more than 200 people, shaking hands and giving hugs.

Tiffs between the Republican Party establishment and tea party factions have flared in Virginia since tea party favorite Ken Cuccinelli lost last year's gubernatorial race. Cantor supporters have met with stiff resistance in trying to wrest control of the state party away from tea party enthusiasts, including in Cantor's home district.

Brat teaches at Randolph-Macon College, a small liberal arts school north of Richmond. He raised just over $200,000 for his campaign, while Cantor spent more than $1 million in April and May alone to try to beat back his challenge.

Washington-based groups also spent heavily in the race. The American Chemistry Council, whose members include many blue chip companies, spent more than $300,000 on TV ads promoting Cantor in the group's only independent expenditure so far this election year. Political arms of the American College of Radiology, the National Rifle Association and the National Association of Realtors also spent money on ads to promote Cantor.

Brat offset the cash disadvantage with endorsements from conservative activists like radio host Laura Ingraham and with help from local tea party activists angry at Cantor.

"Eric Cantor's loss tonight is an apocalyptic moment for the GOP establishment," said ForAmerica Chairman Brent Bozell, a conservative leader who advises several tea party groups. "The grassroots is in revolt and marching."

Last Saturday, Democrats picked Jack Trammell as their nominee for the general election in the 7th District. He is an associate professor of Sociology at Randolph-Macon College, the same school where Brat teaches.