Republican Karen Handel won a nationally watched congressional election Tuesday in Georgia, and she thanked President Donald Trump after she avoided an upset that would have rocked Washington ahead of the 2018 midterm elections.

Returns showed Handel, a former Georgia secretary of state, winning about 52 per cent of the vote over Democrat Jon Ossoff, who won nearly 48 per cent in Georgia's 6th Congressional District.

"A special thanks to the president of the United States of America," she said late Tuesday night as her supporters chanted, "Trump! Trump! Trump!"

It was Handel's most public embrace of the man whose tenuous standing in this well-educated, suburban enclave made a previously safe Republican district close to begin with.

Handel's margin allows Republicans a sigh of relief after what's being recognized as the most expensive House race in U.S history, with a price tag that may exceed $50 million.

Yet the result in a historically conservative district still offers Republicans a warning that Trump, for better or worse, will dominate the looming campaign cycle. Georgia's outcome follows similar results in Montana, Kansas and South Carolina, where Republicans won special House races by much narrower margins than they managed as recently as November.

Republicans immediately crowed over winning a seat that Democrats spent $30 million trying to flip. "Democrats from coast to coast threw everything they had at this race, and Karen would not be defeated," House Speaker Paul Ryan said in a statement.

Voters cast their ballots in the special election at a polling site in Sandy Springs, Ga., on Tuesday. (David Goldman/Associated Press)

Democrats still must defend their current districts and win 24 Republican-held seats to regain a House majority next November. Party leaders profess encouragement from the trends, but the latest losses mean they will have to rally donors and volunteers after a tough stretch of special elections.

Handel, 55, will become the first Republican woman to represent Georgia in the U.S. House, according to state party officials.

Her win comes after losing bids for governor in 2010 and the Senate in 2014, and it builds on a business and political career she built after leaving an abusive home as a teen.

"It's that fighting spirit, that perseverance and tenacity that I will take to Washington," she said Tuesday night.

Republican seat since 1979

Handel is the latest in a line of Republicans who have represented the district since 1979, beginning with Newt Gingrich, who would become House speaker. Most recently, Tom Price resigned in February to join Trump's administration. The president himself struggled here, though, edging Democrat Hillary Clinton but falling short of a majority among an affluent, well-educated electorate that typically has given Republican nominees better than 60 per cent of the vote.

Handel emphasized that Republican pedigree often in her campaign and again in her victory speech.

She also noted throughout the campaign that she has lived in the district for 25 years, unlike Ossoff, who grew up in the district but lives in Atlanta, a few kilometres south of the 6th District's southern border.

Handel and Ossoff exchange words moments before a special election debate at WSB-TV studios in Atlanta on June 6. (Chris Aluka Berry/Reuters)

In victory, she commended Ossoff and pledged to work for his supporters. She noted last week's shooting of Republican Majority Whip Steve Scalise of Louisiana and said politics has become too embittered.

"My pledge is to be part of the solution, to focus on governing," she said.

Ossoff, taking the stage at his own party after conceding the race, told his supporters his campaign "is the beginning of something much bigger than us," adding, "The fight goes on."

Fundraising fight

Party organizations, independent political action committees and donors from Los Angeles to Boston sent a cascade of money into a race, filling metro Atlanta's airwaves with ads and its 6th District neighbourhoods with hordes of paid canvassers.

Contrary to the chants at Handel's victory party, she insisted for months that voters' choice had little to do with Trump. She rarely mentioned him, despite holding a closed-door fundraiser with him earlier this spring. She pointed voters instead to her "proven conservative record" as a state and local elected official.

Her protestations aside, Handel often embraced the national tenor of the race, joining a Republican chorus that lambasted Ossoff as a "dangerous liberal" who was "hand-picked" by House Democratic leader Nancy Pelosi of California. She also welcomed a parade of national Republican figures to Atlanta to help her raise money, with Ryan and Vice-President Mike Pence holding fundraisers following Trump's April visit.

It was enough to help Handel raise more than $5 million, not a paltry sum in a congressional race, but barely a fifth of Ossoff's fundraising haul. The Republican campaign establishment, however, helped make up the difference. A super PAC backed by Ryan spent $7 million alone.

On policy, she mostly echoes party leaders. She said she'd have voted for the House Republican health care bill, though she sometimes misrepresented its provisions in debates with Ossoff. She touts traditional supply side economics, going so far as to say during one debate that she does "not support a living wage" — her way of explaining her opposition to a minimum-wage increase.