By Roberta Rampton and Jeff Mason

WASHINGTON (Reuters) - The United States and Mexico agreed on Monday to overhaul the North American Free Trade Agreement (NAFTA), putting pressure on Canada to agree to new terms on auto trade and dispute settlement rules to remain part of the three-nation pact.

Auto stocks soared and the S&P 500 and the Nasdaq rallied to record highs on the expectation that Canada would sign onto the deal and ease the economic uncertainty caused by U.S. President Donald Trump's repeated threats to ditch the 1994 accord.

Details of gains and concessions in the deal were only starting to emerge on Monday. Trump threatened he still could put tariffs on Canadian-made cars if Canada did not join its neighbors and warned he expected concessions on Canada's dairy protections.

"I think with Canada, frankly, the easiest we can do is to tariff their cars coming in. It's a tremendous amount of money and it's a very simple negotiation. It could end in one day and we take in a lot of money the following day," Trump said.

Negotiations among the three partners, whose mutual trade totals more than $1 trillion annually, have dragged on for more than a year, putting pressure on the Mexican peso and the Canadian dollar . Both currencies gained against the U.S. dollar after Monday's announcement.

The political stakes are high for all three countries. Trump and Republicans in the U.S. Congress up for re-election in November want to ensure farmers and other voters whose jobs depend on trade with Canada and Mexico that the deal is sealed.

Mexican President Enrique Pena Nieto wants to sign the agreement before leaving office at the end of November, and Canadian Prime Minister Justin Trudeau faces a national election expected by October 2019.

Canadian Foreign Minister Chrystia Freeland is expected to travel to Washington for talks on Tuesday. Her spokesman said Canada would sign only a new agreement that is good for the country.

Story continues

Trump spoke with Trudeau on Monday, his economic adviser Larry Kudlow told reporters. The deal with Mexico should serve as a "reset" for talks with Canada, Kudlow said.

90-DAY WINDOW

Officials said they hope Canada will agree to the terms by Friday, when the White House plans to notify Congress formally that Trump will sign the deal in 90 days. Congress has to approve it.

"There are still issues with Canada but I think they could be resolved very quickly," a senior trade official told Reuters in an interview.

If talks with Canada are not wrapped up by the end of this week, Trump plans to notify Congress that he has reached a deal with Mexico, but would be open to Canada joining, U.S. Trade Representative Robert Lighthizer told reporters.

Some Republicans in the U.S. Congress called the deal a positive step but said Canada must be part of the new pact.

Trudeau spoke to Pena Nieto on Sunday and shared their commitment to reaching a successful conclusion of NAFTA "for all three parties," the prime minister's office said.

Mexican Foreign Minister Luis Videgaray told a news conference in Washington that if Canada and the United States do not reach an agreement on NAFTA, "we already know that there will still be a deal between Mexico and the United States."

NEW AUTO RULES

The Mexico-U.S. discussions focused on crafting new rules for the automotive industry, which Trump has put at the heart of his drive to rework a pact he has repeatedly described as a "disaster" for American workers.

Matt Blunt, president of the American Automotive Policy Council, which represents General Motors Co , Ford Motor Co and Fiat Chrysler Automobiles NV , said the group was optimistic about the new deal, though it was still reviewing the details.

The deal would require 75 percent of auto content to be made in the NAFTA region, up from the current level of 62.5 percent, a U.S. trade official said. A fact sheet describing the bilateral agreement specified the content would be made in the United States and Mexico.

That requirement could shift some auto parts manufacturing to Mexico from China, a White House official told Reuters, speaking on condition of anonymity.

The Trump administration said the deal improves labor provisions, in part by requiring 40 percent to 45 percent of auto content to be made by workers earning at least $16 per hour.

That measure could move some production back to the United States from Mexico and should lift Mexican wages, the White House official said.

The United States relented on its demand for an automatic expiration for the deal, known as a "sunset clause."

Instead, the United States and Mexico agreed to a 16-year lifespan for the deal, with a review every six years that can extend the pact for 16 years, U.S. Trade Representative Lighthizer said.

Mexico agreed to eliminate dispute settlement panels for certain anti-dumping cases, a move that could complicate talks with Canada, which had insisted on the panels.

Monday's announcement lifted equity markets in all three countries, with shares in automotive companies standing out on relief that the deal appeared to end the uncertainty that has dogged the sector for months.

General Motors Co , Ford Motor Co , and Fiat Chrysler Automobiles NV gained between 3.3 percent and 4.8 percent, while Canadian auto parts makers such as Magna International Inc gained 4.6 percent.

(Reporting by Roberta Rampton and Jeff Mason; Additional reporting by Sharay Angulo, David Lawder, Dave Graham, Andrea Hopkins, David Shepardson; Editing by Paul Simao, Grant McCool and Dan Grebler)