A slight gain on Friday was not enough to stop stocks from posting a loss this week, weighed down by fears of a possible trade war and White House turmoil.

The S&P 500 notched a 1.2 percent loss for the week, despite a 0.2 percent gain on Friday. The Dow Jones industrial average also fell 1.5 percent on the week as shares of Boeing dropped 6.8 percent on the trade tensions. The Dow closed 72.85 points higher on Friday at 24,946.51.

The Nasdaq composite closed flat at 7,481.99 amid a 1.4 percent decline in Google-parent Alphabet and a 0.7 percent fall in Amazon shares. The index also fell 1 percent for the week.

Tariffs on steel and aluminum imports are expected to come into effect in the coming weeks, after Trump signed two declarations last week. While Canada and Mexico are exempt from the deal, investors worry that countries around the world including China may strike back.

"The market is still vulnerable to headlines, particularly with regard to trade and any retaliation," said Quincy Krosby, chief market strategist at Prudential Financial. We're "waiting for reaction from the European Union and reaction from the Chinese in terms retaliatory responses."

Also on investors' minds, Krosby added, is the two-day Federal Open Market Committee monetary policy meeting next week, with Wall Street preparing for new Federal Reserve Chair Jerome Powell to lead bankers in raising rates.

"It's Jerome Powell's first conference and the market expects a rate hike ... [investors] will also be paying attention to his comments and the press conference," Krosby said. "He's extremely fluent in the language of the Fed, extremely fluent in the thinking of the Fed."

In political news, President Donald Trump has reportedly decided to remove national security advisor H.R. McMaster from the U.S. administration, according to a Thursday report by the Washington Post. The White House has, however, denied that any changes are set to emerge within the National Security Council.

Adding to the political drama, CBS News reported on Friday that White House chief of staff John Kelly, too, could depart the administration as early as today. Fears that the chief of staff could be on his way out were kept at bay, however, after The Wall Street Journal reported that Trump and Kelly settled on a temporary "truce."

Kelly, rattled by President Trump's abrupt firing of Secretary of State Rex Tillerson via Twitter earlier in the week, had told colleagues to start looking for new jobs, the Journal reported. Tillerson's dismissal comes a week after Gary Cohn resigned as the National Economic Council's director.

Brendan McDermid | Retuers

NYSE Trader on the floor

"I think the market has understood for a while that this is a chaotic White House," said Michael Shaoul, chairman and CEO of Marketfield Asset Management. He noted that stocks have been trading in a close range recently. "I think it will take more economically driven or corporate-driven news for the market to make up its mind."

Elsewhere, consumer sentiment rose to a level not seen since 2004 in March, according to a preliminary reading from the University of Michigan. Meanwhile, the Labor Department said job openings increased to 6.3 million in January, a record.

"This week investors have been focused on Washington," said Jeff Kravetz, regional investment strategist at U.S. Bank Wealth Management. "But the narrative seems to be changing with strong economic numbers."

"I think investors are going to be focused on economic data" and the Federal Reserve next week, Kravetz said.