* Wal-Mart, Target, CVS, Costco, Kroger hit hard
* Amazon gives biggest lift to S&P
* Tech sector set to drop for second week
* Energy stocks gain 1 pct, propping up S&P
* Dow up 0.03 pct, S&P down 0.07 pct, Nasdaq down 0.15 pct (Updates to late afternoon)
NEW YORK, June 16 (Reuters) - U.S. stocks mostly edged lower on Friday as Amazon.com's $13.7 billion deal to buy upscale grocer Whole Foods roiled the retail sector and wounded shares of an array of companies including Wal-Mart and Target.
The deal by Amazon, a proven retail disruptor, marked a major step by the internet retailer into the brick-and-mortar retail sector.
Wal-Mart shares sank 5 percent, weighing the most on the S&P 500 and the Dow. Shares of Target, CVS Health and Costco fell between 4 percent and 7 percent.
"It's disrupting a number of industries here, and that's what's causing the market problems," said Bruce Bittles, chief investment strategist at Robert W. Baird & Co in Sarasota, Florida.
Amazon shares gained 3.6 percent, making the stock the biggest boost to the S&P 500. Whole Foods shares surged 30 percent.
The S&P consumer staples sector fell 1.3 percent, by far the worst performing major sector. The S&P 500 food and staples retailing index dropped 4.7 percent.
Grocery chain Kroger was the biggest loser on the S&P 500, down 11.3 percent, while Supervalu dropped 12.8 percent.
"I would not like to be somebody playing in the grocery space right now," said Jan Rogers Kniffen, chief executive of retail consultancy firm J. Rogers Kniffen WWE in New York.
The Dow Jones Industrial Average rose 6.71 points, or 0.03 percent, to 21,366.61, the S&P 500 lost 1.65 points, or 0.07 percent, to 2,430.81 and the Nasdaq Composite dropped 9.45 points, or 0.15 percent, to 6,156.06.
The technology sector fell 0.2 percent, continuing its recent slump. Tech has led the S&P 500's 8.5 percent rally this year, but is on track for its second week of declines, prompting questions over whether investors are moving money into other sectors.
"I think we need to see more of a pullback to say there is a serious rotation going on as opposed to just some profits coming off the top," said Chuck Carlson, chief executive officer at Horizon Investment Services in Hammond, Indiana.
Energy shares rose 1.1 percent, propping up the S&P 500. Oil prices edged up from 2017 lows as some producers cut back on exports.
U.S. homebuilding fell for a third straight month in May to the lowest in eight months as construction activity declined broadly. Investors were continuing to digest the Federal Reserve's interest rate hike on Wednesday, with some concerned about the economy's ability to absorb higher rates.
Advancing issues outnumbered declining ones on the NYSE by a 1.00-to-1 ratio; on Nasdaq, a 1.44-to-1 ratio favored decliners. (Additional reporting by Caroline Valetkevitch in New York, and Yashaswini Swamynathan, Natalie Grover and Sruthi Shankar in Bengaluru; Editing by Anil D'Silva and James Dalgleish)