The Senate confirmed her nomination 62-37, with 10 Democrats joining the Republican majority.
Nielsen, 45, graduated from the University of Virginia School of Law in 1999.
Nielsen also will be the only DHS secretary who has previously worked at the department.
Democrats complained that Nielsen lacks the experience needed to run a major agency with 240,000 employees. No Republicans opposed her nomination. The DHS has 22 subagencies, including immigration enforcement, transportation security, disaster preparedness and response, the Secret Service, and the Coast Guard.
Nielsen is close to White House Chief of Staff John Kelly, who was President Donald Trump's first secretary at the Department of Homeland Security before he was brought in to discipline Trump's chaotic office at the end of July. She comes to the job with more cybersecurity and risk management qualifications than any of her predecessors, having founded a risk management firm.
"As our country continues to face ever-evolving threats at home and overseas, it is critical - now more than ever - that we have an experienced and apolitical leader at the Department of Homeland Security to work with us in our efforts to keep New Hampshire and the United States safe, secure, and free", said Sen.
Sen. Kamala Harris, D-Calif., said Nielsen has played a role in several questionable Trump administration decisions, including a travel ban to restrict entry from six mostly Muslim countries, termination of a program for young immigrants and what Harris called a "feeble response to Hurricanes Irma, Maria and Harvey".
Nielsen said at her confirmation hearing last month that climate change is a crucial issue and said the Trump administration is revising its climate models to better respond to rising sea levels.
Homeland Security has been leading the charge on implementing Trump's aggressive immigration agenda, and Nielsen pledged to continue that work. "I am confident that Kirstjen's mission-focused style of leadership will help her succeed in leading the men and women of DHS and ensuring we reform and improve the Department", said McCaul.
But both Kelly and Nielsen have said that a wall on the entire 2,000 mile (3,200 kilometer) frontier with Mexico would be inappropriate, and that other measures, including electronic monitoring, would be required as well.