- Amazon announced it was buying Whole Foods for $13.7 billion, or $42 a share.
- The consumer staples sector dropped 1 percent, capping gains on the S&P, which closed flat for the session, but managed a weekly gain.
- Wal-Mart shares fell more than 4 percent, but the Dow posted a record close.
The S&P 500 ended marginally higher for the week on Friday following a deal that ignited a sell-off among big retail and grocery companies.
In turn, shares of Kroger, Costco, Target, SuperValu, Sprouts Farmers Markets and Dow-component Wal-Mart all dropped sharply following the news.
CFRA analyst Tuna Amobi said in a note that the deal "could presage a major long-term disruption of the grocery business by AMZN, as the company further leverages its technology, logistics and fulfillment infrastructure."
The consumer staples sector dropped 1 percent, capping gains on the S&P, which closed flat for the session.
The Dow Jones industrial average managed a record closing high despite Wal-Mart's 4.6 percent fall. The 30-stock index has also posted four straight weekly gains.
Investors also parsed through weaker-than-expected economic data on Friday, as housing starts and consumer sentiment figures both missed expectations.
"Overall, I think this is some of the initial optimism that drove the market higher cooling," said Mark Luschini, chief investment strategist at Janney Montgomery Scott.
Housing starts and consumer sentiment are the latest data to disappoint investors and economists. Earlier this week, the Labor Department said the consumer price index — a key measure of inflation — fell 0.1 percent last month. Economists polled by Reuters expected a rise of 0.2 percent.
Meanwhile, the Commerce Department said Wednesday that retail sales fell 0.3 percent in May, marking the largest one-month decline since January of last year. The sudden drop confounded economists, which had forecast a 0.1 percent gain.
Overall, U.S. economic growth slowed in the first quarter, with GDP increasing at a 1.2 percent annual rate. GDP grew at a 2.1 percent in the last quarter of 2016.
Concerns regarding the disappointing economic data come against a backdrop of hawkish monetary policy from the Federal Reserve. On Wednesday, the U.S. central bank raised rates for the second time this year and also laid out a plan to unwind its $4.5 trillion balance sheet.
"The market is still overly concerned with some of the growth areas and the fact that the Fed is planning to raise rates further," said Robert Pavlik, chief market strategist at Boston Private Wealth.
Jeff Zipper, managing director of investments at the Private Client Reserve of U.S. Bank, said: "The bear camp seems to be winning right now. We've recently seen disappointing economic data."
Still, the three major indexes ended mixed for the week, with the S&P and Dow notching weekly gains and the Nasdaq falling slightly. Stock funds also pulled in $24.6 billion last week, the most since President Donald Trump won the election in November.
The Dow Jones industrial average rose 24 points, or 0.11 percent, to close at 21,384.28, with Chevron leading advancers and Wal-Mart the biggest decliner.
The rose 0.69 points, or 0.03 percent, to end at 2,433.15, with energy leading five sectors higher and consumer staples lagging.
The Nasdaq pulled back 13.74 points, or 0.22 percent, to close at 6,151.76.
About four stocks advanced for every three decliners at the New York Stock Exchange, with an exchange volume of 2.267 billion and a composite volume of 5.248 billion at the close.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded near 10.4.