The United States and Canada are moving closer to resolving their trade differences and could reach a deal by the end of the week that keeps the three-country North American Free Trade Agreement intact.

Both countries are under pressure to find a way to preserve NAFTA and to avoid the United States and Mexico from moving ahead without Canada, as President Donald Trump has threatened. Republican lawmakers are warning the White House that a bilateral agreement will not pass congressional muster, while industry groups said a NAFTA without Canada would take a significant economic toll.

Speaking to reporters in the Oval Office on Wednesday, Trump said he was optimistic that the Canadians would soon become a part of an expanded deal made earlier in the week with Mexico.

“Right now we call it the U.S.-Mexico trade agreement, and we’ll see whether or not Canada get its into it,” the president said. “I think it’s probably not going to be good at all if they don’t.”

In what he said was a hint to the country’s willingness to join into new trade deal, Trump said he had spoken to Justin Trudeau, Canada’s prime minister, by phone the night before. “Hey, he called me,” the president said. “I didn’t call him.”

On Wednesday, Chrystia Freeland, Canada’s foreign minister, expressed optimism that the talks were moving in a positive direction.

“Mexico has made some significant concessions which will be really good for Canadian workers,” Freeland told reporters outside the office of the U.S. trade representative. “On that basis, we are optimistic about having some really good productive conversations this week.”

The agreement appears to be giving the United States much of what it has been demanding over the past year, particularly related to automobiles. Mexican officials have essentially agreed to limit imports of cars and car parts into the United States by accepting a deal that would impose punitive tariffs of up to 25 percent on imports that exceed a certain threshold, according to officials.

Mexican officials insisted Wednesday that the pact would offer their industry important protection from the threat of Trump’s auto tariffs by carving out an exemption for a large volume of autos and car parts.

Ildefonso Guajardo, the Mexican economy secretary, described the auto provisions as a win for Mexican carmakers, saying that around 70 percent of Mexican automotive exports will qualify for free trade under NAFTA and that the side agreement would help ensure that any impact from Trump’s proposed auto tariffs would be limited.

“It respects our existing capacity, it respects the new plants that are being developed, and it provides room for growth,” Guajardo said.

But auto industry executives said such an agreement could ultimately limit the number of imports from Mexico, push production outside of North America and raise prices for vehicles.

“If we run up against these quotas, we are going to make manufacturing more expensive in the United States. Period,” said Ann Wilson, senior vice president of government affairs of the Motor & Equipment Manufacturers Association.

White House officials have been attempting to sell the agreement it reached with Mexico as one that Canada cannot refuse, but several issues still remain to be worked out between the U.S. and its northern neighbor — including Canada’s dairy tariffs and a legal framework for settling trade disputes.

Legal experts remain divided about what would happen to the U.S.-Canada trading relationship if they are no longer knit together through NAFTA. White House officials have said publicly that they think that a bilateral deal with Mexico can be done, but privately they expressed doubts about the legal implications of casting Canada aside.