GOP candidate Ben Chafin won the special election for the 38th Senate District on Tuesday, solidifying Republican control of the entire General Assembly.
With 99 percent of the votes counted, Chafin beat Democrat Mike Hymes 59 percent to 32 percent, according to the Virginia Board of Elections.
Independent Rick Mullins had 9 percent of the vote.
Chafin's victory comes after an expensive and bruising battle, which saw both sides claiming they were victims of unfair attack ads.
"I am especially gratified that the voters were able to see through the baseless negative attacks that became the sole focus of the Democrats' campaign,'' Chafin said in a statement.
Republicans now control 21 seats in the Senate compared to the Democrats' 19. Republicans have overwhelming control of the state House. Gov. Terry McAuliffe is a Democrat.
Democrats had hoped that Hymes could pull off an upset victory in a heavily red district, which stretches across several counties in the heart of the economically depressed coal country in southwest Virginia. If Hymes had won, Democrats would regain control of the Senate, as Democratic Lt. Gov. Ralph Northam would be the tie-breaking vote in a split Senate.
With control of the upper chamber at stake, both parties invested heavily in the race. Hymes raised more than $930,000 in contributions and in-kind support, with the vast majority coming from Democratic party funds. Chafin raised more than $760,000, with heavy backing from the Republican Senate Caucus.
"Our entire caucus has been working toward this day since 2007,'' Senate Republican Leader Thomas K. Norment, Jr. said in a statement. ``Having a 21st Republican Senator will help us strengthen Virginia's economy and ensure conservative, fiscally responsible management of the commonwealth's budget.''
The seat was previously held by conservative Democrat Phil Puckett. His abrupt resignation in June gave control of the Senate to Republicans, who used their new leverage to prevail against McAuliffe in a monthslong showdown over whether the state budget should include Medicaid expansion. A possible job offer to Puckett by the GOP-controlled Virginia tobacco commission at the time of his resignation is the subject of an FBI investigation.
Also Tuesday, Democrats won newly vacant House seats in northern Virginia and the Hampton Roads area. Rip Sullivan Jr. defeated Republican Dave Foster in the 48th House District, which includes Arlington and Fairfax County. And Joe Lindsey beat Republican Marcus Calabrese in the 90th House District, which includes Norfolk and Virginia Beach.