Republican A. Benton Chafin Jr. won a state Senate seat Tuesday that secured GOP control of the General Assembly, dimming Gov. Terry McAuliffe’s legislative prospects and erasing the last vestige of blue from Southwest Virginia.

Chafin, a freshman state delegate, easily defeated Democrat Mike Hymes to fill the Senate seat that Phillip P. Puckett (D-Russell) abruptly resigned in June. The nonpartisan Virginia Public Access Project (VPAP) called the race shortly before 8 p.m.

The race — potentially the most expensive state Senate contest in Virginia history — was one of four special elections statewide Tuesday. Voters in Northern Virginia and Hampton Roads chose Democratic delegates for two empty House seats. And in central Virginia, a town council race put the commonwealth’s new voter identification rules to their first test.

The Senate election was the most important of the day given its impact on Richmond’s upper chamber. Republicans already dominate the House, so the GOP victory in the Senate put the General Assembly fully in the hands of a party that opposes the Democratic governor’s top policy aims.

“It’s my second pickup for the Republican Party,” Chafin said in a phone interview from his victory party at Pizza Town restaurant in Lebanon. The 54-year-old lawyer, cattle farmer and First Bank & Trust chairman said the Russell County House seat he won last fall hadn’t been in Republican hands since 1939.

Republican A. Benton Chafin Jr. was declared the winner of Tuesday’s special election for the Virginia Senate seat vacated by Phillip P. Puckett (D-Russell). (Bristol Herald Courier/Associated Press)

Puckett caused an uproar in June when he suddenly gave up his 38th District seat amid discussions with Republicans about a job for himself and a judgeship for his daughter.

His resignation handed control of what had been an evenly divided Senate to Republicans in the middle of a standoff over the state budget and Medicaid expansion. His departure led the Senate and McAuliffe to cave, accepting a state spending plan that did not expand Medicaid, as allowed under the Affordable Care Act, to 400,000 uninsured Virginians.

Puckett made the move as he was considering a job created specifically for him at the GOP-controlled Virginia Tobacco Indemnification and Community Revitalization Commission. After the deal became public, Puckett said there was no quid pro quo — but withdrew his name from consideration. It is unclear whether his daughter, who was widely considered a good candidate for the judicial post she already held on a temporary basis, will be considered for a permanent appointment. Federal investigators have launched an inquiry.

For Democrats, Puckett was the last man standing Chafin prevailed in a part of Virginia that has grown more Republican even as Northern Virginia has tilted the state overall in the other direction. He was the only state lawmaker west of Roanoke with a “D” by his name. The Chafin win gives Republicans a 21-to-18 advantage in the Senate, which has one vacancy with the retirement of Henry L. Marsh III (D-Richmond) in July. Marsh’s seat will be filled in November. When the chamber was evenly split, Democrats had control because Lt. Gov. Ralph Northam, who breaks tie votes, is a Democrat.

“End of an era: no more coal country dems,” Republican National Committee spokesman Michael Short declared in an e-mail.

Democratic Party leaders kept a low profile on election night as Republicans churned out news releases and tweets celebrating the Senate victory and even congratulating the two Democrats who held onto two of their party’s seats in the GOP-dominated House.

Once all the spending has been tallied, the Chafin-Hymes race could surpass the $1.55 million record set this year in the special election to fill the Senate seat that Northam left to assume the office of lieutenant governor.

Hymes and Chafin had raised a combined $1.48 million before Election Day, and money continued to rush in and out of both campaigns in the home­stretch, according to VPAP. Hymes pulled in $779,000, including a $228,652 infusion this week from the Democratic Party of Virginia. Chafin has taken in $690,000, with a last-minute $47,000 from the Senate Republican Caucus.

A third candidate in that race, independent Rick Mullins, raised $12,466.

In Northern Virginia, Richard “Rip” Sullivan (D) defeated David M. Foster (R) to complete the term of former delegate Robert Brink (D-Arlington), who resigned to accept a job with the McAuliffe administration. As a Republican, Foster was considered the underdog in the Democratic-leaning legislative district, which includes Arlington and parts of McLean.

Some of the polarizing issues that have nudged Southwest Virginians toward Republicans drove Democrats to the polls in Northern Virginia.

“I don’t want to see us lose seats to Republicans,” said Lacey Wootton of Arlington, who cast her vote for Sullivan because she agrees with his support of same-sex marriage and abortion rights.

A five-way race for a Farmville Town Council seat grabbed statewide attention because it was the first requiring voters to follow the state’s new photo identification law. The new rules did not apply to the three legislative elections because they were scheduled before the law took effect July 1. Those races were governed by the past law, which required voters to present identification but not a photo. The stricter standard will apply to all races in the Nov. 4 general election.

The new rule did not seem to cause many problems in Farmville, where three watchdog groups — Virginia New Majority, the League of Women Voters and the Lawyers’ Committee for Civil Rights Under Law — dispatched observers.

As of early afternoon, just two of the more than 300 people who had gone to the polls did not have the photo ID needed to vote, said Prince Edward County Registrar Dale Bolt. Both were elderly women — one 96, the other about 80 — and they were able to obtain temporary photo identification through Bolt’s office and return to the polls to vote, he said.

Tram Nguyen, co-executive director of Virginia New Majority, said election observers had reported that about half of voters were caught by surprise by the photo requirement. But almost all were able to dig a driver’s license or some other photo ID out of their wallets.

Nguyen said she was concerned that more voters could be caught unaware of the new requirement when it comes to the general election in November. “We’re talking an August 19 special election, so the folks turning out today are a little more politically aware,” she said.

The fourth race was in Hampton Roads, where Joseph C. Lindsey (D) easily defeated Marcus A. Calabrese (R) for the 90th District seat in the House. Lindsey will replace former delegate Algie T. Howell Jr. (D), who announced his resignation last month to take a job with the Virginia Parole Board.

Robinson reported from Arlington.