WASHINGTON — Senate Democrats on Friday relented in their flirtation with a government shutdown over a dispute about health care benefits for coal miners, and with less than an hour before the midnight deadline, the Senate approved a measure to fund the government through April.

The party’s willingness to take the nation to the brink of a government shutdown signaled its intention, just weeks after its election drubbing in Rust Belt states, to quickly leverage the sorts of issues that propelled Donald J. Trump to victory.

The House on Thursday passed a short-term spending bill that would keep the government open through late April and extend through that month health care benefits for retired miners who were set to lose them at the end of the year. But Democrats wanted those benefits to last for a year, and slowed down voting on the measure with the threat of rejecting the bill.

“We never intended to shut down the government,” Senator Chuck Schumer, Democrat of New York, the incoming minority leader, said on the Senate floor Friday evening. He added, “I think we’ve made our point.”