(CNN) — Former President Barack Obama was among the Democrats celebrating their party’s electoral wins Tuesday night, congratulating Ralph Northam and Phil Murphy.

“This is what happens when the people vote. Congrats @RalphNortham and @PhilMurphyNJ . And congratulations to all the victors in state legislative, county and mayors’ races. Every office in a democracy counts!” Obama tweeted.

Northam won the Virginia governor’s race and Murphy took a New Jersey governor’s office that had been in Republican Chris Christie’s hands for eight years.

Former Vice President Joe Biden also tweeted congratulations, writing, “A resounding defeat tonight for President Trump. Voters around the country rejected the ugly politics we have seen this past year. Instead, they chose candidates who unite and inspire us.”

He continued by individually congratulating Democratic candidates who won across the country so far, including those in mayoral and statehouse contests.

Virginia’s gubernatorial contest was the first major test of Democrats’ ability to rebound after Trump’s victory. Both Obama and Biden, who are showing an appetite to play surrogate roles in 2018, campaigned for Northam in the race leading up to the election.

Hillary Clinton retweeted herself on Tuesday night, reminding her followers of her tweet she sent a day after she lost the 2016 election to Donald Trump.

She retweeted herself saying, “Yes!” to a tweet where she wrote, “Scripture tells us: Let us not grow weary in doing good, for in due season, we shall reap, if we do not lose heart.”