The Senate voted to confirm former Raytheon executive Mark Esper as U.S. defense secretary, ending the longest period in Pentagon history without a congressionally approved leader.