NEW YORK (Reuters) - U.S. stocks gained ground on Tuesday as upbeat results from Walmart boosted investor sentiment and high-level U.S.-China trade talks resumed in Washington.

All three major U.S. equity indexes closed higher, with the Nasdaq ending its seventh consecutive day in the black.

Stocks have recovered broadly from their year-end selloff, with the Nasdaq up almost 21 percent from its Dec. 24 low and the S&P 500 more than 18 percent. More stocks are making 52-week highs than at any time since Wall Street was taking those indexes to records in August and September.

Stocks pared their gains late in the session, however, after a Reuters story quoted New York Fed President John Williams saying a different economic outlook would be necessary for the U.S. Federal Reserve to resume its interest rate hikes.

“(Williams) did say (the Fed was) going to be drawing down the balance sheet for some time,” said Tim Ghriskey, chief investment strategist at Inverness Counsel in New York. “Perhaps that caused some concern in the markets.”

Consumer discretionary stocks, led by Amazon.com, provided the biggest lift to the S&P 500 and Nasdaq, while Walmart Inc headed up the blue-chip Dow’s advance.

Walmart reported a better-than-expected jump in same-store sales during the holiday quarter, sending shares of the world’s largest retailer up 2.2 percent.

Slideshow ( 3 images )

“Walmart is the big story today,” said senior market strategist for Allianz Investment Management in Minneapolis. “You take a look at what we had last week with weaker-than-expected retail sales, and now Walmart’s coming in saying they had the best Christmas season in some time.

“It provides reassurance to the market.”

A fresh round of high-level trade talks between the United States and China began in Washington, with U.S. Chamber of Commerce vice president Myron Brilliant expressing hope that “the two sides will reach a comprehensive, bold and significant trade agreement.”

On Wednesday, the Federal Open Market Committee (FOMC) is slated to release minutes from its January policymaking meeting. The minutes are expected to reaffirm the central bank’s statement last month that it would be “patient” with respect to further rate hikes after markets swooned late in December on fears of an economic slowdown.

Indeed, in the quarters ahead, analysts see a slowdown in corporate profit growth. While fourth-quarter profits are expected to have increased by 16.3 percent, the outlook going forward grows cloudier.

First-quarter 2019 earnings are now seen dropping by 0.6 percent from last year, which would mark the first annual decline since the earnings recession that ended mid-2016.

Slideshow ( 3 images )

The Dow Jones Industrial Average rose 8.07 points, or 0.03 percent, to 25,891.32, the S&P 500 gained 4.16 points, or 0.15 percent, to 2,779.76 and the Nasdaq Composite added 14.36 points, or 0.19 percent, to 7,486.77.

Of the 11 major sectors in the S&P 500, all but healthcare and industrials closed in positive territory.

Amazon ended the session up 1.2 percent, bouncing back from a two-day sell-off following news that the e-commerce giant’s China unit is in merger talks with Chinese shopping site Kaola.

Shares of Freeport McMoRan jumped 6.6 percent after Citigroup raised the stock to “buy” from “neutral.”

Advancing issues outnumbered declining ones on the NYSE by a 2.14-to-1 ratio; on Nasdaq, a 1.63-to-1 ratio favored advancers.

Between the New York Stock Exchange and Nasdaq, 287 stocks hit 52-week highs, the most since September 21.

The S&P 500 posted 42 new 52-week highs and no new lows; the Nasdaq Composite recorded 97 new highs and 20 new lows.

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