The speaker of the Texas House, Dade Phelan, won renomination in a runoff on Tuesday, surviving a bruising Republican primary challenge from a party activist and first-time candidate who was backed by former President Donald J. Trump and his Texas supporters.

The race, in a southeast Texas district that includes part of the city of Beaumont, was a bitter political showdown among some of the most powerful players in Texas politics, and was likely to have been one of the most expensive ever for a Texas House seat.

Millions poured in to the campaigns during the primary, including large donations from West Texas oil and gas billionaires and out-of-state school-choice advocates who backed the challenger, David Covey. For his part, Mr. Phelan had help from deep-pocketed donors like Miriam Adelson, the Las Vegas casino magnate and widow of the Republican megadonor Sheldon Adelson.

Mr. Covey, a technical adviser to the oil and gas industry who has described himself as a “very committed Christian and a conservative,” led Mr. Phelan in the first round of voting in March, when neither candidate won a majority.

But during the runoff, Mr. Phelan rallied his supporters and campaign contributors, significantly out-raising his opponent through the middle of May.

“We came this close,” Mr. Covey said in a speech to supporters in Orange, Texas. He added that even in defeat his campaign had started a movement.