The victory over Jack Ciattarelli, which ended Democrats’ 44-year re-election losing streak in the state, was far tighter than polls had predicted.Gov. Philip D. Murphy is the first Democratic governor to be re-elected in New Jersey in more than 44 years. His campaign focused on his record during his first term and his left-leaning approach to governing.Bryan Anselm for The New York TimesPhilip D. Murphy, a New Jersey Democrat whose aggressive approach to controlling the pandemic became a focal point of the bid to unseat him, narrowly held onto the governor’s office in an unexpectedly close election that highlighted stark divisions over mask and vaccine mandates, even in a liberal-leaning state.With roughly 90 percent of the vote tallied, Mr. Murphy was ahead of his Republican challenger, Jack Ciattarelli, by less than 1 percentage point when The Associated Press called the race just before 6:30 p.m. on Wednesday after a protracted count. The bulk of the outstanding votes were in Democratic strongholds.For Democrats who had long assumed Mr. Murphy’s victory was assured even as the national electoral picture darkened, the 24 hours after polls closed proved tense: Mr. Ciattarelli at one point held a substantial lead.Every public opinion poll throughout the campaign had showed that Mr. Murphy would coast to an easy victory. But Mr. Ciattarelli hammered away at the state’s high taxes and polarizing issues such as whether schools should teach about systemic racism, and he repeatedly asserted that Mr. Murphy’s tough Covid rules were undermining personal liberty.Democratic strategists began whispering about a vague sense of anxiety that only intensified after rank-and-file Republicans turned out in force to the second debate in South Jersey in mid-October.Mr. Murphy’s narrow victory — and a key loss in the Virginia governor’s race — were widely interpreted as ominous signs for Democrats, potentially signaling voters’ dismay with President Biden, fears about the economy and pushback on cultural issues that were central to some G.O.P. campaigns. Still, a win by any margin was considered a significant milestone. Mr. Murphy, a wealthy former Goldman Sachs executive, is the first Democrat in more than four decades to be re-elected in the largely suburban state.“You know, we just had the most ‘New Jersey’ experience,” Mr. Murphy said, joking about his protracted victory during a speech to supporters in Asbury Park late Wednesday night. “I was on my way someplace, and it took us longer to get there than we planned.”At the end of the contentious race, Mr. Murphy sounded a conciliatory note.“If you want to be governor of all of New Jersey, you must listen to all of New Jersey. And New Jersey, I hear you,” Mr. Murphy said.Mr. Ciattarelli did not immediately concede, and a spokeswoman wrote on Twitter that it was “irresponsible” to declare a winner in the close race.Mr. Murphy, 64, had campaigned largely on his first-term record and his unabashedly left-leaning approach to governing a state where there are nearly 1.1 million more registered Democrats than Republicans.The pandemic, which has killed about 28,000 residents, hobbled much of the region’s economy and disrupted the education of 1.3 million public school students, persisted as the campaign’s defining issue.Mr. Murphy used executive orders to enforce some of the country’s strictest rules to curb the spread of the virus. Just before Memorial Day he was one of the last governors to repeal an indoor mask mandate. As new cases of the highly contagious Delta variant spiked during the summer, he was among the first to require teachers to be vaccinated or submit to regular testing.The coronavirus pandemic was the defining issue of Mr. Murphy’s first term.Bryan Anselm for The New York TimesResidents surveyed in polls and academic studies gave Mr. Murphy some of his highest marks for the way he responded to the pandemic.But Mr. Ciattarelli, a former assemblyman, made Mr. Murphy’s edicts a centerpiece of his campaign, using ads and stump speeches to attack vaccine mandates and mandatory masking in schools, and blaming Mr. Murphy’s lockdown orders for hurting small businesses and keeping students out of school for too long.Lindsey Laverty, 31, said it was Mr. Murphy’s mask and vaccine mandates that made her vote against him.“We need to get back to freedom and choice,” she said Wednesday in Somerville, N.J.The pandemic was by no means the only issue. Mr. Ciattarelli drove home a Wall Street-versus-Main Street theme and homed in on a 2019 comment by Mr. Murphy about taxes. “If you’re a one-issue voter and tax rate is your issue, either a family or a business — if that’s the only basis upon which you’re going to make a decision,” Mr. Murphy said, “we’re probably not your state.”Mr. Ciattarelli’s campaign plastered parts of the comment across billboards, on Facebook and in television ads all over the state.Mr. Murphy appeared to significantly underperform President Biden’s 2020 showing in highly educated suburban counties that had favored Democrats in the Trump era — the kind of counties that were central to the Democratic takeover of the House in 2018, including in New Jersey.“What’s changed in recent weeks is that President Biden’s approvals have taken a hit as the national mood has shifted,” said Michael Soliman, a veteran of New Jersey Democratic politics, referencing Mr. Biden’s weak poll numbers. He said Democrats — both progressive, like Mr. Murphy, and more conservative, like Steve Sweeney, the Democratic leader of the State Senate, who was still locked in a close race on Wednesday — were feeling the effect of that shifting national playing field.Michael DuHaime, who was the lead strategist for the Republican former Gov. Chris Christie’s victories in 2009 and 2013, said former President Donald J. Trump’s absence from the ballot returned some voters to the G.O.P. fold.“They didn’t like Donald Trump. It’s pretty simple. It wasn’t some endorsement to go far left,” Mr. DuHaime said.At campaign stops over the last week, Mr. Ciattarelli displayed a Boston Bruins jersey emblazoned with Mr. Murphy’s name as he reminded supporters of the governor’s Massachusetts roots and his white-shoe investment banking pedigree.In the end, more voters appeared to support the approach taken by Mr. Murphy, who in his first term established New Jersey as one of the most progressive states in the nation.Over the last four years, he locked in a deal to gradually increase the minimum wage to $15, raised the tax rate on income over $1 million and legalized marijuana. He made community college free for students in households with incomes of less than $65,000, restored voting rights to people on probation or parole, and authorized drivers’ licenses for undocumented immigrants.Results trickled in slowly after polls closed Tuesday at 8 p.m. from Democratic strongholds like Essex and Camden Counties, skewing the early totals and making it clear that the race would be far tighter than expected.Central to the delay in calling the race was the number of outstanding mail and provisional ballots.New Jersey did not permit local election officials to begin “preprocessing” ballots this year until Election Day, causing a backlog of more than 520,000 mail ballots to be counted in a single day. New voting equipment used to enable voters to cast ballots early, in person, also caused confusion; in some cases, voters had to use emergency provisional ballots to cast their votes — adding to the volume of ballots to tally.All 120 legislative seats were also on the ballot. Democrats were expected to retain control of Trenton, but did appear to be on track to lose several seats — including one held by Mr. Sweeney.Takeaways From the 2021 ElectionsCard 1 of 5A G.O.P. pathway in Virginia. More