The Senate confirmed Jeh C. Johnson on Monday as secretary of homeland security, the fourth person to lead the sprawling domestic safety agency since its inception after the Sept. 11, 2001, terrorist attacks.

Johnson, 56, the former general counsel for the Pentagon, won confirmation on an overwhelming vote, 78 to 16, as the Senate continued churning through an end-of-session batch of nominees to fill President Obama’s Cabinet and the federal judiciary.

Unlike some nominees who have encountered Republican opposition, Johnson won the votes of 23 GOP senators, a majority, and all 55 members of the Democratic caucus.

“As we all know, the president has asked Jeh Johnson to take on a difficult and demanding job,” said Sen. Thomas R. Carper (D-Del.), chairman of the Homeland Security and Governmental Affairs Committee. “Fortunately for our nation, he is a strong leader and well prepared to face the challenges that await him.”

Johnson, who will be one of three African Americans in the Cabinet, is expected to be sworn in by the end of the week.

A former Air Force general counsel, Johnson takes over a department that oversees 22 agencies with a far-flung jurisdiction that includes counterterrorism, fighting illegal immigration and responding to natural disasters.

During confirmation hearings last month, Johnson pledged to try to create unity in a department notorious for lacking it.

“I hope to be a visible leader [and] remind people of the importance of the overriding, unifying mission of homeland security,” he testified.

In a sign of lingering battles over Senate confirmation rules, Republicans protested the effort to move to a vote on Johnson’s top lieutenant, Alejandro Mayorkas, forcing rarely required procedural moves to set up votes this week on that nomination and others.

Last month, Senate Democrats set a precedent that allowed them to change the chamber’s rules on most of Obama’s executive and judicial nominees, eliminating the 60-vote hurdle to clear a filibuster. Republicans have protested the unilateral move by using even more obscure procedural moves, which have clogged up the Senate’s work for the past week.

Democrats are hopeful that some agreement can be worked out by the end of the week to easily clear Mayorkas and Janet L. Yellen, the nominee for chairman of the Federal Reserve, and possibly a few others.