Beijing — A Chinese official on Thursday denied that talks with the U.S. over a trade deal are foundering, saying the sides are working to resolve conflicts.

Commerce Ministry spokesman Gao Feng said China was committed to working toward an agreement.

"China is willing to address core concerns together with the U.S. on a basis of equality and mutual respect, and to work to conclude our discussions on the first phase" of a trade deal, Gao told reporters at a weekly briefing.

Get Breaking News Delivered to Your Inbox

"This will benefit China, the U.S. and the world," Gao said.

Financial markets have swung between elation and gloom in recent days as conflicting reports over the talks swirled. Some have cited officials saying they believe a deal is likely by the year's end, while others have expressed skepticism.

Gao described such reports as "outside rumors that are not at all reliable."

Investors were boosted when Chinese Vice Premier Liu He, the country's top trade negotiator, said on Wednesday he is"cautiously optimistic" about striking a preliminary deal and invited U.S. trade officials to Beijing to continue talks, according to Bloomberg.

"Increased trade tensions gave a risk-off tone to markets overnight, but sentiment has recovered somewhat since China invited the U.S. trade delegation to face-to-face talks," Ned Rumpeltin, European head of FX strategy, said in a research note.

U.S. stocks were set to rise when markets opens.

President Donald Trump began imposing punitive tariffs on Chinese exports nearly 18 months ago, citing trade and technology policies that he says violate Beijing's market-opening commitments and are unfair.

Since then, tariffs have been raised by both sides on billions of dollars' worth of each other's exports, squeezing farmers and manufacturers. A fresh set of tariffs is due to take effect Dec. 15 on about $160 billion of Chinese exports to the U.S., including smartphones, laptops and other consumer goods. That could mean higher prices for Americans during the critical holiday shopping period.

Mr. Trump had said he hoped to sign a preliminary agreement with his Chinese counterpart, Xi Jinping, at a regional economic summit in Chile in mid-November that was canceled due to protests. Prospects for the two leaders to meet and sign a deal soon appear uncertain.

Earlier this week Mr. Trump indicated he was prepared to go ahead with more tariff hikes if he does not get a deal with China that he likes.

China threatens "countermeasures"

The approval this week of a U.S. congressional resolution expressing support for human rights in Hong Kong after months of increasingly violent political protests drew an angry response from China's foreign ministry.

It also rattled financial markets: Markets fell Thursday for a second straight day in most regional markets after losses overnight on Wall Street.

China took control of the former British colony in 1997, allowing it a semi-autonomous status and separate legal and economic systems. It bristles at foreign comments on matters that it considers its internal affairs.

China has urged Mr. Trump not to sign the legislation, which passed both the U.S. House of Representatives and Senate almost unanimously.

"If the U.S. goes its own way, we will take countermeasures," said Foreign Ministry spokesman Geng Shuang.

But Geng adopted a less fiery tone when asked about the trade talks, reiterating the stance that reaching an agreement is in the best interests of everyone.

"We hope both could meet each other halfway," Geng said.

Wall Street analysts said the turmoil in Hong Kong is a distraction, but is unlikely to torpedo a trade deal.

"As of now, Trump signing the bill into law could impact the trade talks, but we do not believe that it will outright derail these efforts," analysts with Raymond James said in a report. "Continued tensions over Hong Kong are likely to remain a potential wrinkle in the overall trade talks, but we do not anticipate them becoming an overriding issue that derails negotiations."