In her first visit to Mexico as homeland security chief, Nielsen met with the country's foreign and interior ministers and oversaw the signing of three deals to work more closely together on customs and border issues.
"No one should underestimate the strength and commitment of the United States to the United States-Mexican partnership," she said, adding in thickly accented Spanish: "We are neighbors, we are allies, we are friends."
Mexico has been stung by President Donald Trump's verbal attacks on Mexican immigrants, his insistence on renegotiating the North American Free Trade Agreement (NAFTA), and his vow to make the country pay for his planned border wall.
The latter subject has twice caused Mexican President Enrique Pena Nieto to cancel trips to Washington after heated phone calls with Trump.
In the wake of the second cancellation, Trump's son-in-law and senior adviser Jared Kushner visited Mexico, and Nielsen is now the latest high-level US envoy to visit in what appears to be an effort to smooth over ties.
The strain has raised fears over the future of the two countries' close cooperation on issues like migration, drug trafficking and other border security matters.
But Nielsen was upbeat on bilateral ties.
Mexican Foreign Minister Luis Videgaray acknowledged the tension, but said the countries were trying to find common ground.
"It's true, there are issues on which we have different opinions. We don't agree on everything. But we are determined not to let our differences define our relations," he told a press conference.
"The focus of our work is on the areas where we agree and the things we can do together."
The newly signed agreements are three of more than 20 that are currently in the works, Nielsen said.
Under them, the US and Mexico will work more closely together to crack down on contraband or counterfeit manufactured goods, consolidate customs inspections for commercial shipments, and streamline health inspections for agricultural goods, said Videgaray.