WASHINGTON — The Senate on Thursday confirmed Ashton B. Carter to be the next defense secretary, installing a new Pentagon chief as the United States increases military action against the Islamic State.

Mr. Carter, a former deputy defense secretary who is President Obama’s choice to replace Chuck Hagel, was approved by a vote of 93 to 5, a striking scene of accord as tensions mount over the wait to confirm Loretta E. Lynch as the next attorney general. Five Republicans opposed Mr. Carter’s confirmation.

The transition to a new Pentagon chief comes as Congress considers a number of pressing defense issues, including a request by Mr. Obama that would formally authorize military action against the Islamic State, also known as ISIS or ISIL.

Republicans were cautious to draw a distinction between supporting Mr. Carter and supporting Mr. Obama, especially as many lawmakers expressed reservations about the parameters of the authorization regarding the use of ground troops and its place with an existing authorization for military action.