Maryland will get more of its energy from renewable sources after the state legislature overrode one of Gov. Hogan’s 2016 vetoes. (Jamie Francis/AP)

Maryland Gov. Larry Hogan may have the approval ratings. But the Democrats who control both houses of the state legislature have the votes.

Despite vigorous opposition from the popular Republican governor, the Maryland Senate voted 32 to 13 on Thursday to override Hogan’s veto of a bill to boost the state’s use of renewable energy.

The House of Delegates voted to reverse the veto earlier this week.

That means the measure — which requires Maryland to obtain 25 percent of its energy from wind, solar and other renewable sources by 2020, instead of ­20 percent by 2022 — will become law.

Legislative analysts estimate that the annual compliance costs for energy companies would average $28 million to $111 million from 2017 through 2025, an expense that will probably be passed on to consumers.

The governor, who campaigned for office on a pledge to keep taxes and fees from rising, has said that those costs amount to a “tax increase that will be levied upon every single electricity ratepayer in Maryland.”

After Thursday’s vote, Hogan spokeswoman Amelia Chasse said senators who backed the override effort “are now faced with the unenviable task of explaining to their friends, neighbors and constituents why they voted to increase the price of energy in Maryland.”

Democrats, who hold strong majorities in both chambers of the legislature, countered that the measure would create green jobs, and that the environmental and public-health benefits from complying with the enhanced requirements would outweigh any costs.

Some also argued that renewable energy is quickly becoming less expensive, suggesting that the additional costs eventually would be negligible — if not nonexistent.

“I and everyone else here care about the ratepayers, but when I look at the figures, it gives me a comfort level that we’re actually doing our ratepayers good,” Sen. Thomas M. Middleton (D-Charles) said during a debate on the Senate floor.

Sen. Stephen S. Hershey Jr. (R-Kent), who opposed the bill, said the standards will force ratepayers to further subsidize out-of-state companies, because most renewable energy comes from outside Maryland.

“It’s not a good program,” he said.

Hershey had requested that a previously scheduled override vote be delayed for one week, telling reporters that he would use the time to try to sway Democrats to oppose the measure. He acknowledged Thursday that he hadn’t persuaded any lawmakers to change their minds.

Environmental groups applauded the veto override, and said it was especially welcome at a time when Republicans in Washington are questioning climate change and promising to roll back federal regulations.

“Maryland this week has struck one of the first meaningful blows from a state legislature in pushing hard for environmental advancement,” said Mike Tidwell, director of the Chesapeake Climate Action Network.

The state Senate, where Democrats control 33 out of 47 seats, needed 29 votes to overturn the veto. One Democratically held seat is vacant in the chamber.

The House of Delegates override vote was 88 to 51. Democrats, who control 91 out of 141 seats in that chamber, needed 85 votes to reverse the veto. Democrats control two seats that are vacant.