BOSTON — State lawmakers moved quickly to plug an expected gap in funding for private health clinics that perform abortions.

A supplemental budget bill, which breezed through the Legislature this week, included $8 million for clinics run by Planned Parenthood and other providers who are expected to lose funding under changes to the federal Title X grant program.

The measure passed the state House of Representatives on Wednesday, by a vote of 140-14. The Senate followed Thursday, approving the spending bill 33-5.

Gov. Charlie Baker, a pro-choice Republican, signed the bill on Friday.

“Signing this bill into law ensures women’s health providers across Massachusetts will continue to have access to these critical funds and we thank our colleagues in the Legislature for their swift response to changes in federal policy,” Baker said in a statement.

The federal rules, set to go into effect in May, will block federal dollars for providers that perform or promote abortion as a method of family planning.

Abortion providers would have to perform them in facilities that are physically and financially separate from those offering other Title X services, such as gynecological care, cancer screening and testing for sexually transmitted diseases.

They would also be barred from suggesting abortion as a method of family planning, which abortion rights advocates have called a “gag order” on physicians.

About 100 health care providers in Massachusetts — including five run by the Planned Parenthood League — received about $4.3 million through the Title X program in fiscal 2018, according to federal data.

The money helped provide services to an estimated 75,000 people, according to health providers.

Dr. Jennifer Childs-Roshak, CEO of the Planned Parenthood League of Massachusetts, praised state lawmakers for moving swiftly to allocate funding.

“Our elected leaders have made clear that Massachusetts believes everyone, regardless of income or insurance, deserves access to the best medical care and information possible,” she said.

She called the gag rule “malicious,” adding that “states should not have to protect their residents from their own federal government.”

“All people — no matter what state they live in — deserve access to affordable birth control, lifesaving cancer screenings, and (sexually transmitted infection) testing and treatment,” Childs-Roshak said.

Providers who are part of the Title X program give priority to low-income families, who receive care for free or on a sliding scale. Federal law already prohibits government funds from being used for abortion.

Still, religious conservatives and abortion opponents have long complained that Planned Parenthood affiliates receive Title X money while also providing abortions, which means the funds could be improperly mixed.

Health and Human Services Secretary Alex Azar has said the Trump administration’s goal is protecting “the dignity of human life from conception to natural death.”

Massachusetts is one of 17 states where public money is used to fund abortions and other reproductive services. Providers are reimbursed through Medicaid payments, though it’s not clear how much the state spends on abortion procedures.

Abortion opponents called the state’s move to plug the funding gap a “giveaway to the abortion business” and accused Democratic lawmakers of “rewarding a major campaign contributor.”

“Abortion businesses, like Planned Parenthood, shouldn’t receive taxpayer funds in the first place, particularly those related to family planning, as abortions are not family planning,” said Chanel Prunier, executive director of the Renew Massachusetts Coalition, in a statement.

The measure passed Beacon Hill with bipartisan support.

Among Republicans voting in favor of the bill were Senate Minority Leader Bruce Tarr of Gloucester, and Reps. Jim Kelcourse of Amesbury, Brad Hill of Ipswich and Lenny Mirra of West Newbury.

The federal rule change is still subject to a lawsuit by 22 state attorneys general, including Attorney General Maura Healey, as well as medical advocacy groups.

The suit asks a judge to block the rule from going into effect, which would effectively prevent the cuts to health clinics from going forward.

Christian M. Wade covers the Massachusetts Statehouse for North of Boston Media Group’s newspapers and websites. Email him at cwade@cnhi.com.