Mark Esper was sworn in at the White House in a ceremony hosted by President Donald Trump.

Army Secretary Mark Esper was sworn in as U.S. secretary of defence on Tuesday, hours after being confirmed by the Senate in a strong bipartisan vote that ended the longest period by far the Pentagon had been without a permanent top official.

Esper was sworn in at the White House by U.S. Supreme Court Justice Samuel Alito in a ceremony hosted by President Donald Trump and attended by a number of Republican lawmakers. He was confirmed by the U.S. Senate on a vote of 90-8 several hours earlier.

"That's a vote that we're not accustomed to, Mark. I have to say that, so congratulations," Trump told Esper, a former professional staff member of the Senate Foreign Relations Committee and Senate Governmental Affairs Committee.

Esper, 55, a former soldier and lobbyist for weapons maker Raytheon, received strong bipartisan support despite sharp questioning during his confirmation hearing by Democratic Senator Elizabeth Warren about his ties to Raytheon and his refusal to extend an ethics commitment he signed in 2017 to avoid decisions involving the company.

Warren, a 2020 presidential hopeful, was the only member of the Senate Armed Services Committee to voice opposition to Esper's confirmation during the hearing.

Raytheon is the third-largest U.S. defence contractor.

There has been no confirmed defence secretary since Jim Mattis resigned in December over policy differences with Trump. Many members of Congress from both parties had urged the Republican president to act urgently to fill the powerful position.

Trump's previous pick to be secretary of defence, former Boeing Co <BA.N> executive Patrick Shanahan, withdrew from consideration on June 18 after reports emerged of domestic violence in his family.

Senate Majority Leader Mitch McConnell called on members to support Esper as he opened the Senate on Tuesday morning.

"The nominee is beyond qualified. 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 defence is beyond urgent," McConnell said.

Four of the eight "No" votes came from senators running for the 2020 Democratic presidential nomination - Cory Booker, Kirsten Gillibrand, Kamala Harris and Amy Klobuchar.

An Army veteran, Esper served as a congressional aide and a Pentagon official under Republican President George W. Bush before working for Raytheon. He had been Army secretary since November 2017.