LOS ANGELES — Hillary Clinton and Bernie Sanders are locked in a tight race in California, the nation’s most populous state and one that until recently seemed strongly in Mrs. Clinton’s corner, a new statewide poll has found.

The poll, released Wednesday night by the Public Policy Institute of California, showed Mrs. Clinton leading Mr. Sanders among likely voters, 46 percent to 44 percent — within the margin of error. A survey by the organization in March found Mrs. Clinton with a lead of 48 percent to 41 percent over Mr. Sanders.

The survey came as both Mr. Sanders and Mrs. Clinton have stepped up their campaign appearances here in anticipation of the June 7 primary. Mr. Sanders, after initially saying he would not advertise on television here — California is one of the most expensive states for television advertising, given its size and the number of media markets — took to the airwaves this week.

And Mrs. Clinton has quickly responded, with ads set to begin running on Friday in the Los Angeles, Fresno and Sacramento markets: one narrated by the actor Morgan Freeman, another highlighting Mrs. Clinton’s endorsement by the civil rights activist Dolores Huerta. The Clinton campaign will also run Spanish-language ads aimed at Latino voters, and translated commercials in Cantonese, Mandarin, Vietnamese and Korean.

For Mrs. Clinton in particular, the ad buy is a significant reversal: Her campaign had halted its advertising after her decisive victories in the mid-Atlantic states on April 26, aside from a brief return to television in Kentucky.

Mr. Sanders’s aides said he intended to spend nearly all his time in California until the June 7 primary, a signal of how much importance he has attached to a victory here as he tries to keep his campaign going through the convention. His rallies have drawn big, enthusiastic crowds in many parts of the state.

Even with a loss in the primary, Mrs. Clinton would almost certainly win enough delegates to capture her party’s nomination. That said, a loss to Mr. Sanders in this state — which she won in 2008 and which Bill Clinton won in the 1992 primaries — would provide a sour and deflating end to her primary campaign.

It could also encourage Mr. Sanders to stay in the race through the Democratic National Convention in July, at a time when many Democrats would be asking him to step aside and join with Mrs. Clinton in turning the party’s attention to defeating the presumptive Republican nominee, Donald J. Trump.

The new poll takes into account both Democrats and independent voters who said they would vote in the Democratic primary. Among Democrats alone, Mrs. Clinton leads Mr. Sanders by 49 percent to 41 percent, according to the institute. But there has been a surge of people registering as independents, which Democrats say could be aiding Mr. Sanders.

The poll showed that both Mrs. Clinton and Mr. Sanders would defeat Mr. Trump in a hypothetical November contest, though Mr. Sanders appears to have the stronger position at the moment. Mrs. Clinton is leading Mr. Trump among likely voters by 49 percent to 39 percent; Mr. Sanders would beat him 53 percent to 36 percent.

The poll was based on a telephone survey of 1,704 California adults taken from May 13 through Sunday. Of those, 996 were identified as likely voters. The margin of sampling error among that group was plus or minus 4 percentage points.