NEW YORK — Oil prices rose and stocks rallied worldwide on Thursday after China said it had agreed with the United States to cancel tariffs in phases, a key consideration in reaching a deal to end a trade war that has crimped economic growth and roiled markets.

But US stocks pared some gains after Reuters reported rolling back existing tariffs as part of a trade deal faces fierce opposition at the White House and from outside advisers, multiple sources familiar with the talks said.

The Dow and S&P 500 closed at record highs, while the Nasdaq missed a record close by less than two-tenths of a point.

A gauge of global equity performance surged to a 21-month peak, with a pan-European index at its highest since July 2015 after regional shares rose for a fifth straight session.

The dollar gained after comments from a Chinese commerce ministry spokesman about the terms of a potential trade deal prompted investors to dump perceived safe havens such as the Japanese yen, the Swiss franc, bonds and gold.

No timetable was indicated, but a phase one deal is widely expected to include a US pledge to scrap tariffs scheduled for Dec. 15 on about $156 billion worth of Chinese imports, including cellphones, laptop computers and toys.

However, the idea of a tariff rollback was not part of the original October handshake deal between Chinese Vice Premier Liu He and US President Donald Trump, sources told Reuters.

The initial news from China was positive, said David Kelly, chief global strategist at JPMorgan Funds in New York. But with operating earnings lower in a slowing economy, the fundamental justification for this market increase is pretty weak.

Investors have few options outside of equities, with the return in money markets and long-term government debt below the rate of inflation, Kelly said. The economy is generating plenty of wealth but it is all going to the stock market, he said.

The real driver (of the rally) is that investors in the United State and around the world have got little alternatives available to them because of the actions of the central banks, Kelly said, so theyre funneling money into stocks.

MSCIs gauge of stocks across the globe gained 0.28 percent, while the pan-European STOXX 600 index closed up 0.37 percent. Trade-sensitive German shares rose 0.83 percent to close at their highest since February 2018.

Asia had been quiet overnight, with the China news arriving just before European markets opened. Automakers and miners were among Europes top gainers.

The prospect of a recession diminishes if some tariffs are removed, said Peter Cardillo, chief market economist at Spartan Capital Securities in New York. So thats positive for stocks.

On Wall Street, the Dow Jones Industrial Average rose 182.24 points, or 0.66 percent, to 27,674.8. The S&P 500 gained 8.4 points, or 0.27 percent, to 3,085.18 and the Nasdaq Composite added 23.89 points, or 0.28 percent, to 8,434.52.

The global benchmark for crude climbed above $62 a barrel. Brent crude settle up 55 cents at $62.29 and West Texas Intermediate added 80 cents to settle at $57.15 a barrel.

The dollar rose to near three-month highs versus the yen on the trade news, paring losses earlier in the session, while Australias China-sensitive dollar hit a near four-month high.

The dollar index rose 0.18%, with the euro down 0.15% to $1.1048. The yen weakened 0.25% versus the greenback at 109.27 per dollar, while the dollar gained against the Swiss currency, trading up 0.22% at 0.9948 franc.

The benchmark 10-year U.S Treasury note fell 31/32 in price to push its yield up to 1.919 percent.

US gold futures settled down 1.8 percent at $1,466.40 an ounce.

Copper got its customary lift from the China optimism as the country is the biggest buyer of the metal.

Global markets in general are looking toward where trade goes, said Justin Lederer, an interest rates strategist at Cantor Fitzgerald in New York. The market is being dictated by headlines and its risk on, risk off.

SEA Games: Another Amit-Centeno final, as womens 10-ball title match set

SEA Games: Pinoys guaranteed a medal in Mobile Legends: Bang Bang

Floods force 66,000 from homes in Cagayan, other parts of Luzon

SEA Games: Singapore, Vietnam own swimming Day 3; PH gets 3 more medals

SEA Games: Espejo, Pinoys drop tight 3-setter to Indonesia; PH-Thailand next

ICC aims to finalize preliminary exam on PH drug war case in 2020: report

SEA Games: Philippine Blu Girls reach final, as mens softball team falters

Mga napinsalang ari-arian, bumagsak na puno problema sa Ilagan City

Relief goods handog sa mga nasalanta ng Tisoy sa Northern Samar

Ikaw na, habang buhay, Vhong tells wife Tanya

Mga bangkay, buto mula sementeryo sa Matnog inanod sa dagat dahil kay Tisoy

2 scalper timbog sa pagbebenta ng SEA Games tickets sa Pasig

SEA Games: John Marvin bigong makausad sa quarterfinals

Govt data: Millions of Filipinos lifted out of poverty in 2018 Dissecting Data

Panday Sining declared persona non grata in Manila over vandalism

SEA Games: Eumir Marcial leads Pinoy boxers march to finals, as 2 others exit

Thank you all Filipinos! Pinoy surfer sinagip ang atletang Indonesian sa peligro

Cebu expressway almost halfway done: officials