Democrat Ralph Northam captured the Virginia governorship on Tuesday, beating Republican Ed Gillespie in the first major test of how the Donald Trump presidency has affected swing-state politics.

The Associated Press declared Northam, a physician who is Virginia’s lieutenant governor, winner in the race to succeed Democratic Gov. Terry McAuliffe, giving their party another four years in the governor’s mansion.

The win in Virginia, where the governorship has seesawed between the parties in recent years, gave Democrats a double-barreled victory Tuesday night: In New Jersey, voters elected Democrat Phil Murphy governor over Republican Kim Guadagno, ending two terms of GOP control by Gov. Chris Christie.

It was a change in fortune for Democrats who have been frustrated this year in House special elections in Republican districts such as a seat in the Atlanta suburbs. Party officials are hoping the twin victories is a harbinger of success in the 2018 midterm elections.