Stocks closed with solid gains after President Donald Trump indicated a trade deal with China could happen soon and more in Wednesday’s Stock Market Update.

The comment from Trump, along with strong numbers on the housing market, helped stocks overcome early losses.

The S&P 500’s losses began to ease after the government reported that sales of new U.S. homes rose sharply in August. Stocks continued to recover after the release of a rough transcript of a July phone call between Trump and Ukraine’s president that is at the center of impeachment discussions.

The market then climbed into positive territory after Trump, speaking to reporters at the United Nations, said China wants “to make a deal very badly,” adding that “it could happen sooner than you think.”

Trump did not elaborate. Talks between top-level officials aimed at resolving the costly trade war are expected to take place next month.

The market rebound follows a volatile session on Tuesday as investors digested a weak consumer confidence report, more trade war rhetoric and the start of the impeachment inquiry by Democratic leaders in the House.

The release of the transcript fueling the impeachment inquiry didn’t appear to have much of an impact on the market, analysts said.

“If the market really thought it was bad, it would go down and stay down, and it would be the only thing impacting the market,” said Tom Martin, senior portfolio manager at Globalt Investments.

Even so, the congressional probe is adding further uncertainty to the market and could complicate the White House’s efforts to resolve trade disputes with China and other nations.

“The issue is if impeachment ends up being a negative or a distraction, it might hurt Trump’s hand in negotiating with the EU and with China,” Martin said.

That could further drag out the trade disputes, which have already started to have a negative impact on the economies in China, Germany and the U.S.

Chipmakers were among the big winners in the technology sector Wednesday. Nvidia climbed 3.3% and Qualcomm rose 2.7%. Apple, which does a lot of business in China and has much riding on the outcome of the trade war, gained 1.5%.

Citigroup rose 2.1% and Wells Fargo added 1.2% amid a broad financial sector rally as bond yields ticked higher. The yield on the 10-year Treasury rose to 1.73% from 1.63% late Tuesday, a big move. The higher yields help banks charge more lucrative interest rates on loans.

Communication services stocks also helped lift the market out of its early malaise. Google gained 2.2% and Netflix climbed 4%, recouping some of its losses from earlier in the week.

Boeing rose 1.1% as investors applauded the company’s move to form a new safety committee as it deals with the legal and financial fallout from several deadly crashes. Uniform company Cintas climbed 5.7% after it reported a surprisingly good fiscal first quarter profit and raised its forecast for profits and revenue.

Nike jumped after a stellar earnings report and helped lift consumer-oriented companies. Tobacco company Philip Morris rose after calling off merger discussions with fellow tobacco giant Altria.

STOCK MARKET UPDATE

KEEPING SCORE: The S&P 500 gained 18 points, or 0.6%, to 2,984. The Dow Jones industrials gained 162 points, or 0.6%, to 26,970. The Nasdaq rose 83 points, or 1.1%, to 8,077. All three indexes are modestly higher for the third quarter.

Major stock indexes in Europe finished broadly lower.

IMPEACHMENT PRESSURE: Investors retreated and sent the broader market to its worst day of the month on Tuesday as rumblings about an impeachment inquiry into President Donald Trump grew. The congressional inquiry could impact efforts to settle the U.S. and China trade dispute, which has been weighing down global economic growth.

“The optimistic view is that Trump will become more conciliatory in order to counter a possible drop in his approval rating during an impeachment process,” wrote John Normand, head of cross-asset fundamental strategy at J.P. Morgan, in a note to investors. “The pessimistic view is that other countries will compound the President’s domestic challenges with international ones in hopes of scuppering his re-election bid.”

In terms of a broader market impact, some analysts expressed doubts that the drama unfolding in Washington will affect the market significantly.

“Today, while the current crisis will add to equity market instability, we don’t think it will lead to recession or a new bear market,” Sam Stovall, chief investment strategist at CFRA, wrote in a research note.

HOME SWEET HOME: Shares in homebuilders rose broadly after the Commerce Department said sales of newly built U.S. homes jumped 7.1% last month. Lower interest rates have helped pull buyers into the housing market. KB Home gained 3%.

UP IN SMOKE: Altria fell 0.4% and Philip Morris climbed 5.2% after the tobacco giants called off merger talks. Altria has exclusively sold Marlboro cigarettes and other tobacco brands in the U.S., while Philip Morris has handled international sales. The companies had been in discussions to combine more than a decade after splitting.

NICE SWOOSH: Nike rose 4.1% after the footwear and athletic apparel maker handily beat fiscal first quarter profit forecasts. The company had a surprisingly strong 27% rise in revenue from China, despite the ongoing trade war with the U.S. Nike and other footwear companies could face lower sales and higher costs because of tariffs and supply chain issues.

© The Associated Press. All rights reserved.