Tea party challenger David Brat defeated the second-ranking Republican in the House, Majority Leader Eric Cantor (R-Va.). So, who is David Brat? Here he is, in his own words. (Jackie Kucinich/The Washington Post)

David Brat, an economics professor at Randolph-Macon College in Ashland, Va., has just taught Washington — and one of its most powerful leaders — a lesson in humility.

Brat was dismissed by many Republicans inside the Beltway and beyond. They saw an upstart without the brawn, dollars or organization to depose the second-most-powerful man in the House.

He did it by casting himself to the right of House Majority Leader Eric Cantor on immigration and the Affordable Care Act — and, more important, by giving pumped-up primary voters and conservative talkers, including Ann Coulter and Laura Ingraham, an opportunity to make an anti-establishment statement. Last month, Brat’s tea party supporters booed Cantor at a key party meeting in his district. On Tuesday night, about 200 of them erupted in joy at a nondescript building in an office park in Glen Allen.

It was originally billed as a thank-you party for volunteers. But this was victory.

Brat, who teaches Third World economics, sounded every bit the professor as he addressed his stunned supporters Tuesday night.

“The 10th Amendment is the big one; the Constitution has enumerated powers belonging to the federal government. All the rest of the powers belong to the states and the people,” he said, getting huge applause.

Laurie and Gregg Kalata of Midlothian were sitting on their couch in their pajamas after working the polls all day. When they realized Brat had pulled it off, they got up and came to the party.

“He won because people don’t want illegal immigration,” Laurie Kalata said.

“This was not a tea party election. This was a conservative Republicans’ vote,” said Gregg Kalata, who wore a homemade sign that read “7th District GOP voters can’t trust Eric Cantor.”

Like many candidates running long-shot races before him, Brat had spoken on the trail of a sense of momentum. That’s what candidates say.

“It’s getting exciting — and I’m not BS-ing you,” Brat said in an interview last month. “This district is conservative and idiosyncratic, and they’re not overwhelmed by the establishment and their millions. It’s David vs. Rome.”

Unlike most similar seekers, he was right. Rome lost.

House Majority Leader Eric Cantor (R-Va.) gives his concession speech after a shocking upset to tea party favorite David Brat. (NBC 12 Richmond)

Brat has a prominent photograph of Cantor standing beside President Obama on his Web site to embody his message that Cantor hadn’t fought Obama’s agenda hard enough. He summarized his own bid in a Twitter bio: “I am running for Congress to be ERIC CANTOR’S TERM LIMIT. Free Markets, Constitution, Liberty. No more Crony Capitalism!”

On Facebook, Brat’s team posted a picture of Ronald Reagan in a cowboy hat. “Dave pays tribute to President Reagan, and his vision for freedom, every time he says, ‘I will make Washington, D.C., as irrelevant to your everyday life as possible.’”

Larry Nordvig, executive director of the Richmond Tea Party, said Brat’s campaign grew from a dinner Nordvig had with filmmaker Ronald Maxwell, who directed the Civil War epic “Gettysburg” and, more recently, “Copperhead.” They were hashing over ideas for good candidates to challenge Cantor.

Nordvig saw Brat speak at a fundraiser for E.W. Jackson, the conservative minister who nabbed the state GOP’s nomination for lieutenant governor last year, only to be trounced in the general election by Democrat Ralph S. Northam.

“I asked him 45 minutes of questions afterward . . . about what would he do about deficit spending, what would he do about Obamacare, what would he do about amnesty . . . and he gave very satisfactory answers,” said Nordvig, who described Brat as “presidential-looking” — important in an era of televised campaigns. “Between his appearance and his bearing and his answers to tough questions, I knew we had the right man for the job.”

The results Tuesday left him and the other supporters “crazy happy,” Nordvig said. “There’s a lot of, ‘can’t believe this has happened,’ just a wonderful disbelief. Just absolutely thrilled.”

On Fox host Sean Hannity’s show after the victory, Brat said: “I was blessed. I mean, it’s a miracle. . . . God acts through people. And God acted through the people.”

Brat also cited immigration as a difference-maker in the campaign, saying politicians are beholden to the Chamber of Commerce. “They want cheap labor, and that’s going to lower wages for everybody else,” he said.

Brat has long reveled in poking the establishment, talking up battles against the “intellectual elite” while at Princeton, where he earned a master’s degree in divinity, and against “the powerful elite” at American University, where he received his PhD in economics.

His campaign bio points to his time as an economic adviser to Virginia governors, work that prompted an accusation from Cantor that Brat had been too chummy with former Democratic governor Timothy M. Kaine.

After about a decade at Randolph-Macon, Brat took a more direct role in politics. In 2005, he took an unpaid position as an adviser to state Sen. Walter A. Stosch (R-Henrico), co-chairman of the Senate Finance Committee. In that position, Brat researched higher-education initiatives, including a proposal to create a grant program allowing underprivileged students to move beyond high school.

“He wanted some exposure to the legislative process, and I was glad to have him,” Stosch said Tuesday. “Both of us have an interest in education — particularly in economically deprived young people who, without opportunity, would not be able to go beyond high school.”

Stosch said Brat expressed an interest in entering electoral politics in the years he worked for him — at one point putting his name forward to fill a House of Delegates seat. But when Brat pursued his congressional run, he could not count on Stosch’s open support: Cantor was also a friend and former aide to Stosch.

“It was one of those things where it was hard for me to become too actively involved,” Stosch said. “I was caught between my admiration and friendship with both of them.”

Stosch on Tuesday said he was “somewhat surprised” by Brat’s victory, recalling Cantor’s political work ethic.

“There’s a perceptible anti-government mood,” Stosch said. “People are a little bit mad at Washington, and they express that in different ways.”

Mike DeBonis and Aaron Blake contributed to this report.