AUSTIN, Texas — Republicans won handily a closely watched special election Tuesday to keep hold of a suburban Houston district that President Donald Trump won easily four years ago, fending off a national blitz by Democrats in a Texas legislative race.

The victory by Republican Gary Gates, who put more than $1.5 million of his own money into his run for state House District 28, is sure to bring a sigh of relief for the GOP in a race that was being tracked far beyond Texas. By the final weeks, the race had escalated into the first big special election of 2020.

In final unofficial results, Gates polled 58% of the vote to 42% for Democrat Eliz Markowitz.

Presidential candidates Joe Biden and Elizabeth Warren had endorsed Markowitz, and outside groups flooded the race with six-figure checks and television ads. Beto O'Rourke practically made the district a second home after ending his own presidential campaign in November, spending weekends knocking on doors in Katy's affluent neighborhoods.

It escalated a normally minor local election into a high-stakes test of Democrats' chances in Texas this November, and whether suburban voters are turning away from the party of an impeached president.

Last summer, Texas House Speaker Dennis Bonnen, a Republican, was caught confiding to a conservative activist in a secretly recorded meeting that Trump was "killing us" in urban and suburban districts. But Gates, a real estate developer, said that was not his impression from the 150 homes he visited every day.

More than 30,000 voters cast ballots in the election, a 20% turnout.

Trump won the district by 10 points in 2016, but two years later, O'Rourke closed the gap in the district to just three points during his own narrow loss for U.S. Senate.

The election became a release valve for Democrats who were itching for November to just get here already, but it also reflected the striking level of money and national muscle that are poised to swamp legislative races. One national Democratic group called Forward Majority, which is spending millions of dollars nationwide to flip GOP-controlled statehouses, says it has spent $400,000 on the race, at least four times what the group spent on any other Texas district in 2018.

The spending included a TV ad that resurfaced allegations from 2000 that Gates, who has adopted 11 children, abused some of his kids. State child welfare investigators ultimately dropped that case, and Gates put up a counter-ad pushing back on the claims.