The race for California governor appears to be tightening, according to a new poll Wednesday, as former Los Angeles Mayor Antonio Villaraigosa pulled closer to Lt. Gov. Gavin Newsom in what’s shaping up to be an all-Democrat general election in November.

The poll, which was released by the Public Policy Institute of California, also found that voters were closely divided on whether to repeal the state’s new gas tax, strongly backed a controversial “sanctuary state” bill, and continued to support sending Sen. Dianne Feinstein back to Washington.

In the crowded race for governor, Newsom led with 23 percent of likely voters and Villaraigosa was hot on his heels with 21 percent. The duo, both Democrats, have led most recent polls, but Villaraigosa came in higher than in previous surveys.

“There are two clear frontrunners,” said Mark Baldassare, the poll’s director.

They were followed by Democrat John Chiang, the state treasurer, at 9 percent, Republican Travis Allen, a state assemblyman, at 8 percent, Republican John Cox, a San Diego County businessman, at 7 percent, Democrat Delaine Eastin, the former state schools chief, at 4 percent, and Republican Doug Ose, a former congressman, at 3 percent.

As in previous polls, Newsom was up among Bay Area voters and liberals, while Villaraigosa led in Los Angeles and among Latinos.

But taken alongside two other recent online surveys — one conducted by the University of Southern California and the other by Newsom’s campaign — the results suggest a possible challenge for Villaraigosa: how he describes himself on the ballot.

Candidates are forbidden from using their previous titles, so the former Los Angeles mayor can’t identify himself as that even though he led the city for eight years. While the PPIC poll that showed Villaraigosa neck-and-neck with Newsom did identify him as the former L.A. mayor, he did significantly worse in the other surveys, which introduced him to respondents as a “businessman” and “entrepreneur/small businessperson.”

“That the campaigns are still thinking about how they want to describe their candidate suggests it might be important,” Baldassare said.

Another surprising result in the PPIC poll could explain why: Being an elected official is cool again, at least if you’re running for office. Sixty-two percent of likely voters said they thought it was more important for a candidate to have prior experience in elected office, while just 31 percent said it was more important for a candidate to have experience running a business.

That’s a notable shift from past years: In 2010, voters were closely divided, with 44 percent saying elected experience was more important and 43 percent choosing private sector experience.

Baldassare guessed the switch was due to voters comparing Gov. Jerry Brown, who had served in elected offices up and down the ballot before returning to the governor’s mansion, and Donald Trump, who had only worked in the business world before winning the presidency.

The Villaraigosa and Newsom campaigns worked to discredit the respective polls. A Villaraigosa spokesman argued that online surveys tend to oversample wealthier voters, who have been more likely to back Newsom, and said the campaign will not use “businessman” as Villaraigosa’s ballot title.

A Newsom spokesman replied that PPIC oversampled Southern Californians and undersampled Northern Californians, who are typically more likely to vote.

The PPIC poll surveyed 1,705 California adults and 1,042 likely voters between Jan. 21 and Jan. 30, interviewing respondents on both landlines and cellphones. It had a margin of error of plus and minus 4.35 percent among likely voters.

It also found a large majority of likely voters backing the “sanctuary state” bill, which limits cooperation between local law enforcement and federal immigration officials, by 65 percent to 31 percent. They were more divided on the gas tax, which goes to fund road repairs and transit projects, with 47 percent wanting to repeal it and 48 percent wanting to keep it. Both topics saw deep partisan divisions, with independent voters narrowly backing a gas tax repeal.

In the Senate race, the poll found Feinstein well above challenger Kevin de León, the state Senate leader, with 46 percent to 17 percent and 33 percent undecided. She led De León by 48 points among Democrats, suggesting his campaign has yet to gain much traction. No major Republican has entered the race.

“It’s remarkable that we’re on track not to have a Republican on the ballot for governor or senator in the fall,” said Jack Pitney, a political science professor at Claremont McKenna College. “That would be a disaster for the Republican Party.”