Democrats have scored two significant victories in the US - in the first statewide elections since President Donald Trump came to power in January.
In Virginia, Ralph Northam defeated Republican Ed Gillespie in a governorship race marked by tussles on immigration and Confederate statues.
Phil Murphy, who beat Kim Guadagno, will be New Jersey governor.
The results could give an early indication of how next year's midterm congressional elections will turn out.
New York City's Democrat mayor was also comfortably re-elected.
Meanwhile, Virginia voters also made history by electing their first openly transgender state legislator.
Democrats have been craving something to celebrate after defeat in four congressional special elections this year, despite a groundswell of grassroots opposition to President Trump.
Overcoming the flip-flops
With nearly all the votes countered in Virginia, Mr Northam had 53.9% against 44.9% for Mr Gillespie.
Mr Northam, the lieutenant governor of Virginia, will now replace popular Governor Terry McAuliffe, a Democrat.
Mr Northam won despite a series of flip-flops during the campaign.
Progressive supporters were outraged after Mr Northam reversed stance to say he would oppose any attempt by a Virginia city to provide sanctuary to illegal immigrants.
The Democrat offered to work with President Trump after previously calling him "a narcissistic maniac".
Mr Northam also vowed to lead efforts to remove Confederate statues, only to say later that he would leave the decision to local authorities.
And his camp was further embarrassed by a racially charged advert, released by a group supporting his candidacy.
Mr Gillespie, a Washington lobbyist and former Republican party chairman, had accused Mr Northam of failing to curb gang violence and seeking to tear down statues honouring Civil War, pro-slavery secessionists.
Mr Gillespie's style was combative - but he distanced himself from President Trump.
Responding to the election result, Mr Trump tweeted that Mr Gillespie "did not embrace me or what I stand for".
Meanwhile, Virginia voters elected their first openly transgender state legislator in Danica Roem.
The 32-year-old journalist and stepmother ousted a long-time, pro-Trump, incumbent Republican in a race that focused on traffic issues.
Her rival, Bob Marshall, described himself earlier this year as Virginia's "chief homophobe".
In New Jersey, Mr Murphy was comfortably leading the race with 55.5%. His Republican rival Ms Guadagno has 42.6%, with about 90% of the votes counted.
Mr Murphy will replace Republican Chris Christie, who was in office for eight years.