WASHINGTON—The Senate passed its second appropriations bill in five days on Tuesday, boosting spending for the next fiscal year for the Defense Department, medical research and the opioid crisis, and funding other departments through Dec. 7 to avoid a government shutdown before the midterm elections.

In a 93-7 vote, the Senate approved the package of bills known as a “minibus,” in contrast to Congress’s usual use of “omnibus” spending legislation. The House is expected to take it up next week, according to a Republican aide. Lawmakers from both chambers worked jointly on the bill and announced it last week.

The bill funds the departments of Defense, Education, Labor, Health and Human Services and related agencies and makes up much of discretionary spending that Congress appropriates. It is the first time in 22 years that the bills are on track to make it to the president’s desk by the end of the year.

“These milestones may sound like inside baseball, but what they signify is a Senate that is getting its appropriations process back on track,” said Senate Majority Leader Mitch McConnell (R., Ky.) on the chamber’s floor as he encouraged lawmakers to support the bill.

Funding for departments that haven’t yet been funded through the appropriations process, such as the Department of Homeland Security, was extended through a so-called continuing resolution until Dec. 7, effectively pushing back fights that Republicans want to avoid before the midterms, such as President Trump’s demand for funding for a Mexico border wall.

Lawmakers also are still negotiating agreements on a third spending bill, to fund the departments of Interior, Treasury, Agriculture, Transportation, and Housing and Urban Development. Sen. Patrick Leahy (D., Vt.) said lawmakers remained hung up on policy differences.

“We are very close to an agreement,” he said. “We should not delay this package over unrelated policy matters that have no place on must-pass spending bills.”

The bill defies Mr. Trump’s call to cut various health, education and labor programs. Instead, it increases funds for the National Institutes of Health for medical research. It includes an increase of $100, or 1.6%, in the 2018-19 academic year maximum for Pell grants, which are federal financial aid earmarked for the neediest college students.

It also includes $725 million for community block grants, which is $10 million more than the amount for fiscal 2018 and which Mr. Trump’s budget proposed eliminating. The program has long been used by Congress to help state and local governments recover from major disasters, such as hurricanes.

To combat the opioid epidemic, the bill appropriates $3.8 billion, an increase of $2.7 billion over 2017. Of that, $1.5 billion will go to states for grants. The Senate on Monday passed broad, bipartisan legislation aimed at combating the opioid epidemic through new research, treatment and help for families affected by addiction.

The bill gives $674.4 billion to the Defense Department, up $19.8 billion from this fiscal year, and awards U.S. service members a 2.6% pay raise.