Casting serious doubt on Democratic hopes for a blue wave in Texas, Republican Pete Flores defeated Democrat Pete Gallego in Tuesday’s runoff election for a vacant seat in the state Senate — a seat that had been safely Democratic in previous years.

Flores will represent Senate District 19 when the Legislature convenes in January, filling the final two years of the term vacated when former Sen. Carlos Uresti, D-San Antonio, resigned in June, shortly before he was sentenced to 12 years in prison for his role in defrauding investors in a Texas oil services company.

With Tuesday’s victory, Republicans hold 21 of the Texas Senate’s 31 seats heading into the November elections, giving Lt. Gov. Dan Patrick a potentially stronger base of support in the 2019 legislative session.

"For the first time in history, we’ll have 21 Republican senators. For the first time in history, we have a Hispanic Republican senator," Patrick, his arm around Flores, told supporters at the campaign victory party in San Antonio. "Seven weeks from tonight, I have a message for the Democrats that Pete Flores and his hard work delivered here: All this talk about a blue wave? Well, the tide is out."

Flores said his victory with 53 percent of the vote was a testament to the power of the grass roots.

"This campaign showed us what we can do united as Republicans," he said. "We need to continue this momentum until November. I encourage you to take this enthusiasm back home and continue this to elect our Republican conservative candidates."

The district, which stretches from San Antonio to the Big Bend region and the New Mexico border, has traditionally favored Democrats — with Uresti defeating Flores in 2016 by almost 16 points.

But Flores, the former law enforcement director for the Texas Parks and Wildlife Department, began his improbable election victory by finishing first in an eight-way special election on July 31, receiving 34.4 percent of the vote to 28.9 percent for Gallego — an unexpectedly strong showing that kindled GOP hopes for a runoff victory.

At the time, Democrats cautioned against reading too much into Flores’ top finish, noting that four Democratic candidates received a combined 59.3 percent of the vote, while three Republicans received 39.6 percent — a 2.5-point improvement for Democrats from the 2016 election, when Flores was defeated by Uresti.

Republican Gov. Greg Abbott congratulated Flores on his victory, saying his campaign paid for targeted digital ads and knocked on more than 20,000 doors to help his campaign.

"Pete’s strong law enforcement background will be invaluable to the Legislature as we work to combat human trafficking and provide greater protections for our peace officers," Abbott said in a written statement. "I look forward to working alongside him next session to build a brighter future for all Texans."

The defeat denied Gallego’s bid to return to the Texas Capitol. A University of Texas School of Law graduate, Gallego spent 22 years in the Texas House representing a West Texas district and two years in the U.S. Congress.