WASHINGTON—The Senate on Friday confirmed retired Marine Corps Gen. John Kelly as Homeland Security secretary, helping President Donald Trump fill out his national security team on his first day in office.

The Senate confirmed Gen. Kelly on a vote of 88-11.

As head of the Department of Homeland Security, the retired general will be at the center of an immigration debate that is one of the most divisive parts of Mr. Trump’s platform. Gen. Kelly will be charge of the country’s two main agencies focusing on immigration: Immigration and Customs Enforcement, and Customs and Border Protection.

At his confirmation hearing, Gen. Kelly heartened Democrats when he said that a wall along the southern border, as advocated by Mr. Trump, wouldn’t alone keep illegal immigrants from entering through Mexico. He said that border security hinges on building stronger partnerships in Latin America.

Gen. Kelly had previously served as chief of the U.S. Southern Command, the division of the Armed Forces that oversees activities south of Mexico. Earlier, he oversaw operations at the detention center at Guantanamo Bay, Cuba. He was the military’s longest-serving general before he retired in 2016.