The election of Mr. Murphy was yet another low-water mark in a long fall from grace for Mr. Christie, who once saw his approval ratings soar into the 70s and whose re-election margin in 2013 was so high that it instantly vaulted him into the presidential conversation.

And Mr. Murphy’s victory was further rejection of the politics of Mr. Trump, who was roundly defeated by Hillary Clinton in New Jersey last November. Mr. Murphy enjoyed the support of a parade of Democratic luminaries — Barack Obama, Joseph R. Biden Jr. and Al Gore, to name a few — who trekked to New Jersey to rally voters and remind them that this was one of their first opportunities to send a message to the White House. The president suffered another setback on Tuesday in the only other statewide election when Lt. Gov. Ralph S. Northam, a Democrat, was elected governor of Virginia, defeating the Republican candidate, Ed Gillespie.

In the final weeks in New Jersey, Ms. Guadagno, perhaps sensing that she was not gaining any traction, veered toward a style of politics more akin to Mr. Trump’s, campaigning against undocumented immigrants and running caustic ads that twisted Mr. Murphy’s words about cities that offer them sanctuary.

But support from Mr. Trump, who had been frantically tweeting about the Virginia governor’s race for weeks, was nowhere to be found for Ms. Guadagno, nor did any Republican Party luminaries travel to the state to offer their support.

From a campaign that began with a sharp focus on property taxes — she made a promise on primary night not to run for re-election if she failed to lower property taxes — Ms. Guadagno changed course and warned repeatedly that Mr. Murphy would turn New Jersey into a sanctuary state, hoping to energize the base of the Republican Party.

But the strategy fell flat, particularly in a state where the successful Republican Party playbook, which guided Mr. Christie and former governors Christine Todd Whitman and Thomas Kean to victory in an overwhelmingly Democratic state, has relied on winning over the large swath of New Jersey’s independent voters with a message focused on pocketbook issues.