Gov. Tim Walz and top Democratic and GOP lawmakers arrived at a hard-fought spending deal Sunday without the controversial gas tax hike the governor wanted, but with schools gaining significantly more money than Republicans had sought.

The compromise, ending a weeks­long impasse, boosts the general fund overall by 6%, but each side had to jettison priorities — Walz is denied much of the new revenue he wanted for road improvements, while a health care tax that Republicans sought to end survives largely intact.

Walz agreed to slightly trim the 2% tax on health care services in Minnesota that was set to expire this year, one of the central sticking points in the negotiations. Under the deal, the tax will be extended at a rate of 1.8%.

“This is a budget that invests in education, health care and community prosperity in a fiscally responsible manner,” Walz said. “Today we prove that divided government can work for the betterment of the people we serve.”

The $48 billion plan still requires a special session to finish the work of writing key points into legislative language and passing them in the DFL-controlled House and the Republican-led Senate.

Facing an adjournment deadline of midnight Monday, House Speaker Melissa Hortman, DFL-Brooklyn Park, said the work of this session will continue at a “breakneck pace” but acknowledged that a one-day special session will be needed this week.

House Minority Leader Kurt Daudt, R-Crown, said he anticipates the special session could take five days, adding that lingering GOP concerns about the 1.8% provider tax could drag out discussions.

“Minnesotans send us here to do what’s right, not always what’s easy,” Daudt said. “Sometimes compromise sounds good but half of a bad deal is still a bad deal.”

Despite some dissension, the three leaders who negotiated it lauded the compromise.

“I’m glad we’re here saying we got it done,” said Senate Majority Leader Paul Gazelka, R-Nisswa. “Both sides, when you have divided government, want to win. Both sides don’t want to lose. And sometimes instead of win or lose, it’s a draw.”

Gazelka emphasized that the two sides agreed to an income-tax cut for some middle-income families starting in 2019. The GOP claimed victory on taxes by negotiating a 0.25% rate cut for people in a middle-income tax bracket that currently covers married couples filing jointly who make between $38,771 and $154,020. The leaders also reached a deal to make Minnesota taxes conform with the federal tax code, simplifying tax filings.

Lawmakers had said little about the hang-ups in the talks during the final week of negotiations, but ideological differences over taxes were clearly central to the issue. Walz and House Democrats pushed for extending the 2% tax on medical providers to help cover public health programs. Another priority was getting a 20-cent-a-gallon increase in the state gas tax, which Republicans rejected.

Senate Republicans have adamantly opposed increased taxes and argued the state should use its more than $1 billion budget surplus and reserves to pay for any spending increase.

Walz said he listened to the Republican argument on dipping into reserves, and the budget deal includes about $491 million from the reserve.

Minnesota Chamber of Commerce President Doug Loon called the agreement a “wise use of state tax dollars — funding key state priorities while protecting Minnesota taxpayers and Minnesota employers.”

Another priority for Republicans was an agreement to create a panel that will look for $100 million to cut from the Health and Human Services budget over the next two years.

The deal includes $540 million in school funding, with a 2% increase in per-pupil spending in each of the next two years. That is less than what Walz and House Democrats wanted, but significantly more than the 0.5% per year increase in the GOP plan.

The budget debates won’t end now despite the overall spending plan.

Lawmakers on conference committees have been waiting on numbers from leadership so they can finalize budget bills in policy areas such as judiciary and public safety, and environment and natural resources. Once those committees complete their work, the Senate and House will vote on the separate budget plans before they head to the governor’s desk.

On policy matters, legislative leaders said they would defer to the conference committee members to sort through differences but that the resulting bills would have to pass both chambers and get Walz’s agreement.

Joe Davis, executive director of the Alliance for a Better Minnesota, which supports DFL candidates, bemoaned the lack of Democratic priorities in the deal.

“While Republicans blocked common-sense measures like gun violence prevention and paid family leave, Gov. Walz and DFL legislators fought for what matters to Minnesotans, including investing in public schools and expanding access to affordable health care,” Davis said.

The wide gap in negotiating positions, and the ensuing standoff, raised the prospect of the first state government shutdown since 2011, a prospect neither Walz and Hortman nor Gazelka relished.

Sunday’s announcement by the three leaders followed a week of intense negotiations out of public view, as leaders met in the governor’s office to hash out details of the plan. In recent days, they largely refrained from comments on their talks.

The leaders said that while they strived for an open process allowing committees to hash out policy in public, some of the more sensitive elements of the deal required the confidentiality that only meetings behind closed doors can provide. Still, they said they want to work for changes that will promote more transparency.