COLUMBUS, Ohio (AP) — A two-term state lawmaker who was backed by President Donald Trump but who also promoted his ties to Trump critic Gov. John Kasich won a previously deadlocked congressional special election in Ohio, retaining a coveted open U.S. House seat long held by Republicans.

State Sen. Troy Balderson, of Zanesville, was certified Friday as the voters' pick over Democrat Danny O'Connor, the Franklin County recorder, in Ohio's sprawling 12th District. He'll complete the unexpired term of former long-time U.S. Rep. Pat Tiberi, a Republican who retired in January.

After final absentee and provisional ballots were counted, Balderson defeated O'Connor by 1,680 votes — a mere 0.8-percent margin in a district Trump won by 11 points two years ago. The result fell a few hundred votes outside the margin that would have triggered an automatic recount.

Balderson said he was humbled by the victory.

"Danny O'Connor ran a hard-fought race," he said, "but I look forward to earning the support of voters for a fourth time in November as I share my track record of getting things done for Ohioans."

Balderson and O'Connor, who's from Columbus, must face off again for the full two-year term representing a meandering central Ohio district that stretches from Democrat-heavy Columbus into Trump-supporting suburban and rural areas north and east of Columbus. The race pits a 56-year-old Trump supporter with political experience against a 31-year-old challenger who, if elected, would be the youngest member of Congress.

O'Connor said he'll fight on.

"We went door to door, we went house to house, we made our case for change, and the grassroots army we've created is not done yet," he said in a statement. "In fact, we're just getting started. We have eleven weeks to keep talking to voters, listening to their ideas, and to bring home a win for working families in central Ohio this November."

The special election was viewed a test of voter sentiment before November's high-stakes general election, which will decide which political party controls the House. A key issue was the Republican tax cuts, which Balderson embraced in seeking to win the state's wealthiest district and O'Connor criticized as a threat to Medicare and Social Security.

Balderson's victory buoys Republicans concerned over how Trump might be playing among voters, especially in political battleground states such as Ohio. O'Connor's odds were considered long in the district held by Republicans for nearly 35 years. A third candidate, the Green Party's Joe Manchik, won 1,165 votes, or 0.56 percent of the total.

Balderson won while walking a careful line between the Trump-averse traditionalists in his party, including Kasich and Tiberi, and the president's stalwart supporters.

The governor, a 2016 presidential contender and among the GOP's most outspoken critics of Trump, touted his and Balderson's strong working relationship in campaign ads.

Kasich is particularly well-known in the district, which he represented for 18 years before Tiberi was elected in 2000. But the popularity that he's maintained statewide has shifted to coming more from Democrats than from Republicans in recent years.

Tiberi, who also backed Balderson, was among a group of establishment Republicans who left office or announced their retirements from Congress under Trump.

The support from Kasich and Tiberi was perhaps key, but so was that of Trump, who performed well among district voters in 2016.

Balderson now has the advantage of incumbency headed into the November rematch, but both major parties are expected to fight hard for the seat over the next several months.

Trump visited Ohio to campaign for Balderson in the days leading up to the special election and was back in the state Friday to headline the Ohio Republican Party's annual dinner.