DETROIT — Donald J. Trump has promised to change the way American automakers do business. Less than three weeks before his inauguration as president, he has already knocked the companies on their heels.

In a stunning reversal, Ford Motor, the nation’s second-largest automaker, said on Tuesday that it would scrap plans to build a small-car assembly plant in Mexico that Mr. Trump has repeatedly criticized.

Just a few hours earlier, Mr. Trump threatened to impose tariffs on cars made in Mexico by General Motors, the nation’s largest automaker. His message forced the company to defend itself.

Both developments indicate how Mr. Trump is having an enormous impact on how American car companies run their operations, even before he takes office. They also illustrate that one of Mr. Trump’s particular points of criticism, manufacturing in Mexico, has become particularly sensitive.