NEW YORK (Reuters) - Wall Street closed higher on Wednesday as investor optimism was stoked over hopes the United States and China could iron out a trade deal, and benign inflation data suggested the Federal Reserve would hold interest rates steady in the near term.

All three major U.S. stock indexes gained ground, with the S&P 500 and the Nasdaq posting their fourth consecutive advances. For the second straight day, the S&P 500 closed above its 200-day moving average, a key technical level.

Stocks briefly pared gains following a late-morning tweet by U.S. Senator Marco Rubio saying he would introduce a bill to “tax corporate buybacks the same way as dividends.”

In Beijing, U.S. Treasury Secretary Steven Mnuchin said “so far, so good,” regarding ongoing talks aimed at resolving the U.S.-China trade dispute, adding he hoped for “productive” meetings in the days ahead.

“The markets are extremely vulnerable to news,” said Bernard Baumohl, chief global economist at the Economic Outlook Group in Princeton. “(Investors are) waiting and hoping for good news to come out of the trade negotiations with China, and for continued signs that the economy is still growing at a healthy pace without heating up inflation.”

The U.S. Labor Department reported consumer prices were unchanged for the third consecutive month in January, in a sign the Fed could hold rates steady for the time being.

Fourth-quarter earnings season is approaching the finish line, with more than two-thirds of the S&P 500 having reported.

Slideshow ( 4 images )

While analysts now see fourth-quarter earnings growth of 16.6 percent, the outlook for the current quarter is less upbeat.

First-quarter profit is projected to fall 0.3 percent from a year ago, marking the first loss since the earnings recession that ended in 2016, according to Refinitiv data.

The Dow Jones Industrial Average rose 117.51 points, or 0.46 percent, to 25,543.27, the S&P 500 gained 8.3 points, or 0.30 percent, to 2,753.03 and the Nasdaq Composite added 5.76 points, or 0.08 percent, to 7,420.38.

Of the 11 major sectors in the S&P 500, all but utilities and communications services ended the session in positive territory.

Energy was the largest percentage gainer as oil prices saw their biggest increase since late January.

Groupon Inc sank 11.1 percent, one of the biggest losers on the Nasdaq, as reduced traffic led to a fourth-quarter profit miss.

Slideshow ( 4 images )

Generic drugmaker Teva Pharmaceuticals Industries Inc dropped 7.8 percent after forecasting a weaker-than-expected 2019 due to new competition for branded drugs.

General Electric Co advanced 3.9 percent following news the conglomerate booked the most orders for electricity-generating gas turbines in 2018.

Levi Strauss & Co filed documents for an IPO after more than three decades as a privately held company. Rivals Abercrombie & Fitch, Gap Inc and American Eagle Outfitters Inc all dipped on the news.

After the bell, Cisco Systems Inc shares rose after posting better-than-expected quarterly results as the network gear maker benefited from its shift to newer businesses.

Also in after-hours trading, shares of American International Group fell 3 percent after the insurer reported a quarterly loss as it was hit with catastrophe losses.

During the session, advancing issues outnumbered declining ones on the NYSE by a 1.86-to-1 ratio; on Nasdaq, a 1.42-to-1 ratio favored advancers.

The S&P 500 posted 38 new 52-week highs and no new lows; the Nasdaq Composite recorded 78 new highs and 19 new lows.

Volume on U.S. exchanges was 6.91 billion shares, compared to the 7.45 billion average over the last 20 trading days.