SOMERSET, N.J. — Jack Ciattarelli, a former New Jersey assemblyman campaigning on a pledge to lower taxes and on criticism of Gov. Phil Murphy’s pandemic response, won the Republican nomination Tuesday to face Murphy in November’s general election.

With 40% of the total votes counted almost two hours after polls closed at 8 p.m., more than 49% of Republican primary voters had backed Ciattarelli, and the Associated Press projected him as the winner. Hoboken pastor Phil Rizzo had about 26% of the vote, Atlantic County engineer Hirsh Singh had about 22%, and former Franklin Township Mayor Brian Levine had 3%.

“We’re just getting started,” Ciattarelli, 59, told a cheering room of supporters gathered at a banquet hall near the Raritan River here in Middlesex County. “In five months we’re going to celebrate another victory, when we and the people of New Jersey send Phil Murphy back to Massachusetts, and you send me to Trenton to fix our broken state.” (Murphy, who has long lived in New Jersey, was born and raised in Massachusetts.)

Murphy was unopposed for the Democratic nomination.

“The choice in November is clear,” Murphy said in a statement Tuesday. “We can either keep New Jersey moving forward or go backward. It’s a choice between standing for higher wages or going back to an economy that only worked for the wealthy and well-connected. It’s a choice to defend reproductive rights under threat from the U.S. Supreme Court or put political ideology over health care. It’s a choice to make education better and more affordable, from pre-K to college, or a state that only works for the few and not for all.”

» READ MORE: Trump overshadows Republican primary for New Jersey governor as personal attacks fly in closing days

Widely seen as the Republican to beat for months, Ciattarelli faced challenges from the three other candidates, two of whom ran as staunch allies of former President Donald Trump and attacked Ciattarelli as a “false conservative.” The strong combined showing by Rizzo and Hirsh suggested that pro-Trump forces in the party could have mounted a more competitive challenge to Ciattarelli had they coalesced behind one candidate.

Notably describing himself to supporters Tuesday night as a “Reagan Republican” — as opposed to a “Trump Republican” — Ciattarelli promised to lower property taxes, make the state’s pension system solvent, and help small businesses create jobs.

A former county commissioner and entrepreneur who lives in Somerset County, Ciattarelli, sought the GOP nomination four years ago but lost to Lt. Gov. Kim Guadagno, then-Gov. Chris Christie’s deputy. Republicans coalesced around Ciattarelli this year, and he raised millions more in campaign cash than his primary opponents.

Ciattarelli campaigned with a focus on economic issues and the pandemic, saying New Jersey’s perennially high taxes and Murphy’s business restrictions hurt the state. He has also blamed Murphy for keeping schools closed for too long and for the state’s high death rate from COVID-19 in nursing homes.

Murphy, 63, is widely seen as the favorite to win reelection. He entered the year in a strong position, thanks to broad approval of his handling of the pandemic. A poll last month found that his approval ratings have slipped but remain strong.

If reelected on Nov. 2, Murphy would be the state’s first Democratic governor since 1977 to win a second term.

A Rutgers-Eagleton survey released Tuesday found Murphy well ahead of Ciattarelli in a general election matchup, 52% to 24%. But with only 42% of poll respondents saying they would definitely back Murphy, and more than three-quarters saying they either don’t know who Ciattarelli is or have no opinion of him, there is room for the Republican to grow his support before November.

“This campaign isn’t going to be easy,” Ciattarelli said Tuesday night. “It’s going to be hard. It’s going to be real hard. It’s going to be worth every ache, pain and bead of perspiration along the way. I’m all in.”

New Jersey and Virginia, which also voted Tuesday, hold statewide elections in the off-years immediately following presidential races, which are often seen as doubling as early referendums on new administrations in Washington. Unlike last year, when most New Jersey voters cast ballots by mail because of the pandemic, much of Tuesday’s primary was conducted in person.

» READ MORE: Phil Murphy gave New Jersey progressives what he promised. Now they’ve got his back for reelection.

The final weeks of the Republican primary were heated, with Singh and Rizzo competing to win over Trump supporters. Murphy’s campaign, meanwhile, sought to tie Ciattarelli to Trump by highlighting maskless campaign stops during the pandemic and his attendance at a “Stop the Steal” rally last year.

In Camden, Democrats overwhelmingly backed Vic Carstarphen for mayor. Carstarphen, a former City Council member, was appointed mayor last month to finish Frank Moran’s term after Moran resigned. He is now almost sure to win a full term in November in the overwhelmingly Democratic city.

Incumbent Atlantic City Mayor Marty Small Sr. appeared headed for victory, defeating Tom Foley, the city’s former emergency management chief, in a Democratic primary campaign that was exceptionally nasty, even by Atlantic City standards.

”This was the ugliest campaign that I’ve ever been a part of,” Small said, in declaring victory shortly after 9 p.m., in a hoarse speech from his headquarters streamed live on Facebook.

All 120 seats in the Democratic-controlled state Legislature were also up for election, though only a handful had contested primaries.

In the Republican primary for state Senate in the Atlantic County-based Second Legislative District, Vince Polistina beat Trump-aligned attorney Seth Grossman, who came to prominence in 2018 during an unsuccessful congressional race against then-Democrat Jeff Van Drew. Polistina, the choice of area Republican clubs, vowed in a statement to defeat Democrat Vince Mazzeo “and the increasingly radical Phil Murphy Democrats this November.”

Staff writer Amy S. Rosenberg contributed to this article.