A Republican candidate won a shocking victory Tuesday in Texas, capturing a state Senate seat that has been held by Democrats for 139 years -- and fizzling out Democrats’ “blue wave” aspirations to flip the Lone Star State.

Pete Flores, a former leader of the state Parks and Wildlife Department’s law enforcement division, won the reliably blue district against Democrat Pete Gallego.

“I owe this first to God and then to the grassroots in all of our counties in Senate District 19,” Flores said after his opponent conceded the race, the Texas Tribune reported. “Primarily this is an example of what happens when you have a united front and a grassroots effort. So now it’s time to go to work.”

"I owe this first to God and then to the grassroots in all of our counties in Senate District 19. Primarily this is an example of what happens when you have a united front and a grassroots effort. So now it’s time to go to work." — Pete Flores

The runoff election was held following the resignation of Democratic state Sen. Carlos Uresti, who was convicted of helping an oilfield service company he co-owned run a Ponzi scheme.

The Republican’s victory cements the party’s control over the state’s upper chamber, controlling 21 of the state’s 31 Senate seats.

“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,” Texas Gov. Greg Abbott said in a statement. “I look forward to working alongside him next session to build a brighter future for all Texans.”

Former House Speaker Newt Gingrich pointed to Flores’ victory as a blueprint for Republicans to stop the so-called “blue wave” – the coming election of droves of Democrats that some have predicted.

“Flores, a political newcomer competing against a seasoned former Democratic congressman, won in a district that is 73 percent Hispanic and African American – despite virtually all political analysts’ expectations,” Gingrich wrote in a column for Fox News, noting that Flores ran “a big choice campaign.”

“Republicans everywhere should also study this Texas state special election and make the 2018 midterms a big choice election for all American voters. And with only 48 days left until November 6, they must act now,” he added.

"Flores, a political newcomer competing against a seasoned former Democratic congressman, won in a district that is 73 percent Hispanic and African American – despite virtually all political analysts’ expectations." — Former House Speaker Newt Gingrich

Democrats have been targeting Texas as the place where the party could make significant gains in the upcoming midterm election. Among its top targets is Republican Sen. Ted Cruz who’s being challenged by Rep. Beto O’Rourke.

According to recent polling, O’Rourke is trailing Cruz by 9 points.

The Associated Press contributed to this report.