The Senate on Tuesday confirmed President Trump’s nominee for secretary of defense, Mark Esper, in a bipartisan 90-8 vote.

The confirmation ends a record-long seven months that the Pentagon went without a Senate-confirmed leader — amid escalating tensions with Venezuela and Iran.

The post had been vacant since former Secretary Jim Mattis resigned on New Year’s Eve. Esper was one of three people who served as acting defense secretary in the time since.

“The nominee is beyond qualified,” Senate Majority Leader Mitch McConnell said prior to the vote. “His record of public service is beyond impressive. His commitment to serving our service members is beyond obvious. And the need for a Senate-confirmed secretary of defense is beyond urgent.”

Esper, 55, who has been serving as Army secretary since late 2017, previously worked on Capitol Hill as a senior Republican staffer, in top positions at the Pentagon and at the conservative Heritage Foundation. He also served for over a decade in the Army, when he participated in the Gulf War.

Esper, who has a wide range of experience in defense matters, including time on Capitol Hill as a congressional staff member, has said he intends to continue the Trump administration’s focus on improving the combat preparedness of the military, nurturing security alliances around the world and reforming Pentagon business practices.

The only significant challenge to his bid to become Pentagon chief arose from his stint as a lobbyist for Raytheon, a major defense contractor, and his resistance to extending a two-year commitment he made as Army secretary to recuse himself from decisions involving the company.

All eight senators who voted against Esper’s nomination are Democrats. They include Sen. Elizabeth Warren of Massachusetts, a candidate for the Democratic presidential nomination, who has sharply criticized Esper for declining to recuse himself from all matters involving his former employer, Raytheon Co., for the duration of his time as defense secretary.

–with Post wires