SACRAMENTO — California will make up to two months of an HIV-prevention drug available to patients from a pharmacist without a doctor’s prescription.

Gov. Gavin Newsom signed SB159 on Monday, allowing pharmacists to dispense 30 to 60 days of the drug to patients if they first receive counseling on the drug’s effects and an HIV test.

Supporters said the law will remove barriers to people’s access to the drug PrEP, sold under the trade name Truvada. The drug has helped San Francisco reduce its infection rate to record lows.

“Recent breakthroughs in the prevention and treatment of HIV can save lives,” Newsom said in a statement.

State Sen. Scott Wiener, D-San Francisco, who carried the bill, said many patients struggle to obtain the drug, particularly black and Latino men who are gay or bisexual.

“By allowing pharmacists to furnish these revolutionary medicines without a prescription, we will help more people — especially low-income people and people of color — stay negative,” Wiener said when he introduced the bill.

PrEP, or pre-exposure prophylaxis, dramatically reduces the chance that an HIV-negative person who has sex with a positive partner will contract the virus, if the drug is taken daily. Clinical studies show Truvada is 99% effective, according to the San Francisco AIDS Foundation.

Supporters of the bill said many people at risk of HIV infection don’t take the drug because they face long waits to see a doctor. Some doctors refuse to prescribe it because of an anti-LGBTQ bias, backers said.

The bill was endorsed by the San Francisco Department of Public Health, Equality California, the AIDS Foundation and the California Pharmacists Association.

It initially faced opposition from the California Medical Association, the state’s largest physicians lobbying group. The group argued that a doctor’s prescription should be required from the outset, to ensure patients are tested and informed about PrEP’s potential risks.

The medical association withdrew its opposition and took a neutral stance after the bill was amended to prohibit insurance companies from covering PrEP for more than 60 days if a doctor hasn’t prescribed it.

The bill also prohibits insurance companies from requiring patients who want PrEP to receive preauthorization from the insurer, a review process to determine if the drug is medically necessary. PrEP advocates say that delay puts people at risk for infection.

Dustin Gardiner is a San Francisco Chronicle staff writer. Email: dustin.gardiner@sfchronicle.com Twitter: @dustingardiner