NEW YORK, Feb 12 (Reuters) - Wall Street rallied on Tuesday as investors were heartened by a tentative congressional spending deal to avoid another government shutdown and by positive developments in the U.S.-China trade negotiations.

All three major U.S. stock indexes gained more than 1 percent, and the S&P 500 traded above its 200-day moving average for the first time since early December.

President Donald Trump said he would be willing to let the March 1 tariff deadline slide as top U.S. officials arrived in Beijing for high-level talks later in the week to hammer out a solution to the trade dispute between the world’s two largest economies.

Congress cobbled together a tentative bi-partisan border security deal on Monday to avert another government shutdown, but the White House indicated that Trump has not yet decided whether to support it. Funding for the Department of Homeland Security and a host of other agencies is due to expire on Friday.

“It’s somewhat befuddling that the possibility of no government shutdown is driving prices up,” said Oliver Pursche, vice chairman and chief market strategist at Bruderman Asset Management in New York. “It means the narrative, pun intended, is trumping fundamentals,” he added. “We’re seeing swings based purely on emotion.”

The fourth-quarter earnings season is nearing the home stretch, with 70 percent of companies in the S&P 500 having already reported. Of those, 71 percent have beaten consensus estimates.

The outlook for 2019, however, is less rosy. First-quarter earnings are now expected to post a year-on-year decline of 0.3 percent, which would be the first loss since the earnings recession ended in the second quarter of 2016.

The Dow Jones Industrial Average rose 376.06 points, or 1.5 percent, to 25,429.17, the S&P 500 gained 36.15 points, or 1.33 percent, to 2,745.95, and the Nasdaq Composite added 104.52 points, or 1.43 percent, to 7,412.43.

Tuesday’s gains were broad-based. Of the 11 major sectors of the S&P 500, all but real estate were trading higher. Technology stocks provided the biggest boost to the S&P 500, and they also led the Nasdaq’s advance.

Tariff-sensitive industrials headed up the Dow’s gain, led by 3M Co, Caterpillar Inc, United Technologies Corp and Boeing Co.

Amazon.com Inc provided the biggest lift to the S&P 500 and the Nasdaq, rising 2.6 percent after Walmart Inc ended its partnership with logistics firm Devi for a rival same-day grocery delivery service.

Electronic Arts Inc announced its Apex Legends video game has signed up 25 million players in the week since its release, sending its stock up 4.5 percent. The video game maker’s shares have soared by nearly 27 percent since the game’s release.

Shares of Goldman Sachs Group were up 2.0 percent after bank chief David Solomon, speaking at a conference in Florida, said the firm intends to increase its mid-size corporate client roster over the next few years.

Under Armour Inc jumped 6.4 percent after the sportswear company beat analysts’ profit forecasts for the holiday quarter.

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

The S&P 500 posted 42 new 52-week highs and one new low; the Nasdaq Composite recorded 67 new highs and nine new lows. (Reporting by Stephen Culp; Editing by Leslie Adler)