NEWARK — Philip D. Murphy, a former Goldman Sachs executive, cruised to the Democratic nomination for New Jersey governor on Tuesday while Kim Guadagno, the state’s lieutenant governor, easily turned away a spirited challenge to claim the Republican nomination, setting the stage for a November battle to replace Chris Christie, the deeply unpopular incumbent.

Their matchup, the first open election for the governor’s seat in New Jersey since 2005, promises to be as much a referendum on the administration of Mr. Christie — who will leave a state crippled by debt, credit downgrades and creaky infrastructure — as it will be an early test of the electoral impact of Donald J. Trump’s presidency.

“People all across New Jersey are demanding change, and I am here to change things,” Mr. Murphy told a crowd to loud cheers on Tuesday night at his election night party at a hotel in Newark. “Four more years of Chris Christie-style politics won’t make New Jersey the state where we draw the line against Donald Trump. But we will.”

For Mr. Murphy, who served as ambassador to Germany under President Barack Obama, the primary victory caps a yearslong effort to lay the groundwork for a run in which he invested more than $16 million of his own funds and vastly outspent his rivals. It elevates his unique brand of progressive policies and fiscal reform in a state facing a potential crisis over unfunded pensions and underfunded schools, combined with the highest property taxes in the country. It also vaults him into the national dialogue as an early Democratic response to Mr. Trump’s policies.

For Ms. Guadagno, the general election will be a gauge of how a moderate Republican who has not quite embraced the language or policies emanating from Washington can navigate the shifting political waters and chart a conservative course that is still somewhat separate from the White House’s.

In her victory speech, Ms. Guadagno repeated her conservative pledge to shrink government but also tried to show a more moderate side by calling for environmental protections and for equal rights for minorities and for people “no matter their sexual orientation.” She spoke of the need to move “forward” and “with hope.”

“We will make New Jersey better for everyone together,” she said inside a catering hall in West Long Branch.

As she previewed the coming race, she sought to establish a sharp contrast, portraying herself as the candidate of “Main Street” and labeling Mr. Murphy as the candidate of “Wall Street.”

“If we elect Phil Murphy governor of the State of New Jersey, the only person who will be able to live in the State of New Jersey will be Phil Murphy,” she said as the crowd broke into shouts of “Moneybags!”

The fall election — one of the two statewide elections in the country this year, with Virginia’s — will be closely watched around the country by Democrats eager for a political victory after their losses in the 2016 election and in special congressional elections this year.

The passion was evident weeks before votes were even cast on Tuesday, with former Vice President Joseph R. Biden Jr. campaigning with Mr. Murphy and declaring the fall election the “single most important” race of the next three years, even surpassing the 2018 midterm elections.

Within the state, the general election will offer New Jersey voters a stark choice. Mr. Murphy, who proclaims himself “proudly progressive,” has indicated that he is willing to defy the Trump administration’s positions on climate and immigration, as well as raise taxes on some wealthier residents and introduce a public bank, funded by taxpayers, to assist an economic recovery in the state.

Ms. Guadagno campaigned largely on a vow to conduct a full review of state spending, pledging to cut waste, fraud and abuse in the sprawling state government and reinvest the savings into issues like bolstering infrastructure, offsetting high property taxes and addressing shortfalls in school funding.

On Tuesday, she laid out a bold promise to back up her economic platform.

“I promise to you, if we do not in our first term lower property taxes in the State of New Jersey, I will not stand for re-election,” she said.

Mr. Murphy drew some comparisons to an unpopular New Jersey governor who worked at Goldman Sachs, Jon S. Corzine, but his deep pockets allowed him to dominate the primary election, with a seemingly never-ending barrage of digital ads and a robust television campaign that set him apart from a cast of rivals not well known to many voters.

Both Jim Johnson and John Wisniewski offered more progressive platforms than Mr. Murphy, and they increasingly tried to portray his aggressive spending as “buying the nomination.” But Mr. Murphy, who enjoyed the backing of every county Democratic chairman and chairwoman and all the powerful unions in the state, often overpowered their message.

In his remarks, Mr. Murphy checked off the progressive promises that have been the bedrock of his campaign as he vowed to chart a distinctly new course for the state. He spoke about the importance of providing adequate funding for public education, protecting young undocumented immigrants, raising the minimum wage and legalizing marijuana.

“We are going to prove that you can be both pro-growth and progressive at the same time,” he said. “That fairness isn’t just a nice idea but a critical tool for making our economy work for everyone.”

Ms. Guadagno had to overcome the negative connotations of being the No. 2 state official to Mr. Christie, who is leaving office with some of the lowest approval ratings in recent history. Her main opponent, Jack Ciattarelli, sought to brand her early and often as a continuation of the current administration, repeatedly referring to the “Guadagno-Christie administration” in ads and campaign literature.

As political exhaustion over last year’s polarizing election mixed with apathy in New Jersey, voters rarely appeared enthused by any candidate during the primary campaign, often ignoring coverage and seemingly tuning out what many anticipated would be a contested race. Turnout remained low, and the two early front-runners were able to maintain their poll positions, an indication that the political power of the county leaders who endorsed them remains strong.

Despite Mr. Christie’s eight-year run, New Jersey has traditionally favored Democrats — there are 800,000 more registered Democrats than Republicans in the state. Many political operatives say they believe Mr. Murphy begins the general election campaign with a distinct advantage over Ms. Guadagno, who will have to overcome not just Mr. Christie’s poor standing but also that of Mr. Trump, whom 56 percent of voters in the state gave a negative job approval last month, according to a poll from Quinnipiac University.

Mr. Murphy hit that note repeatedly on Tuesday night.

“Make no mistake,” he told his supporters. “What Donald Trump does in Washington matters right here in New Jersey.”