DETROIT — General Motors’ chief executive urged the Trump administration on Tuesday not to scrap the North American Free Trade Agreement, and said any changes in the pact should account for the effect on American automakers and workers.

“There could be unintended consequences, changes made, that would directly impact jobs in the United States,” the G.M. chief, Mary T. Barra, said at an investor conference on the sidelines of the Detroit auto show. “Nafta needs to be modified,” she added, but she rejected the idea that “we need to walk away from it.”

As part of a push to create American jobs, President Trump has said that Nafta should be renegotiated and has at times suggested that the United States could withdraw from the agreement or tax vehicles imported from Mexico, where G.M. makes certain small cars, sport-utility vehicles and pickup trucks.

Saying she favored steps to modernize the agreement, Ms. Barra added, “We are completely aligned with the administration on job preservation.” She said G.M. had had discussions with officials from the United States, Mexico and Canada “to make sure everybody understands the complexity” of how the pact affects automakers and the flow of parts and vehicles across borders within North America.