NEW YORK (Reuters) - The S&P 500 ended slightly higher on Tuesday as gains in tech-related shares offset worries about a weakening outlook for earnings.

Gains in Amazon.com AMZN.O, Facebook Inc FB.O and Apple AAPL.O gave the biggest boost to the S&P 500 and Nasdaq, which ended the day up 0.5%.

Netflix NFLX.O also rose, ending up 1%, after Cowen and Co said the video streaming services provider would benefit from high viewership for the recently released third series of its original show "Stranger Things".

Investors braced for remarks this week from Federal Reserve Chairman Jerome Powell during his two-day testimony before Congress, which starts on Wednesday. Also due on Wednesday is the central bank’s June policy meeting minutes.

Wall Street’s main indexes have retreated from their record closing highs after a robust June jobs report on Friday tempered expectations of an aggressive 50-basis-point interest rate cut by the Fed.

“There may be some clarity coming out in the next couple of days based on what Powell says at these hearings,” said Bucky Hellwig, senior vice president at BB&T Wealth Management in Birmingham, Alabama.

“The 10-year (Treasury) yield has just plummeted,” he said. “With flatter earnings coming into the third quarter, we’ve seen the PE multiple expansion courtesy of these lower rates.”

Trade tensions and their effect on corporate America will be front and center when S&P 500 companies kick off the second-quarter earnings season next week.

RBC Capital Markets downgraded 3M Co MMM.N to "sector perform," citing macro pressures from China, auto and electronics sectors. The industrial conglomerate's shares fell 2.1%, while the S&P industrial index .SPLRCI ended down 0.2%.

Analysts’ forecasts for S&P 500 companies profits weakened further Tuesday, with second-quarter earnings now expected to have fallen 0.2% from a year earlier, according to Refinitiv IBES data.

The Dow Jones Industrial Average .DJI fell 22.65 points, or 0.08%, to 26,783.49, the S&P 500 .SPX gained 3.68 points, or 0.12%, to 2,979.63 and the Nasdaq Composite .IXIC added 43.35 points, or 0.54%, to 8,141.73.

In another sign of the trade war's impact, Germany's BASF BASFn.DE forecast a 30% fall in its adjusted annual profit, citing trade friction.

The United States and China are set to relaunch trade talks this week after a two-month hiatus. White House economic adviser Larry Kudlow said discussions with the European Union on a trade pact were also progressing.

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

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

Volume on U.S. exchanges was 5.77 billion shares, compared to the 6.74 billion average for the full session over the last 20 trading days.