NEW YORK (Reuters) - The S&P 500 ended slightly lower on Friday as investors braced for potential damage from Hurricane Irma as it drove toward Florida, while a decline in big tech names like Apple and Facebook pushed the Nasdaq down more sharply.

The Dow eked out a gain, helped by a 4.0-percent rise in shares of insurer Travelers TRV.N.

Insurer shares rose broadly, with the Dow Jones U.S. Insurance Index .DJUSIR up 2.1 percent, recouping some losses after being under pressure recently as the southern United States braced for another powerful storm closely on the heels of Hurricane Harvey.

Irma, one of the most powerful Atlantic storms in a century, lashed Cuba and the Bahamas as it drove toward Florida, while U.S. officials were preparing a massive response to the storm.

“Investors are really in a wait-and-see mode given their concern about the impact of Hurricane Irma on Florida and wherever else it ends up going,” said Kate Warne, investment strategist at Edward Jones in St. Louis.

“Overall, we are seeing the market and investors sort of hunker down to see what the damage and destruction turns out to be,” she said.

The Dow Jones Industrial Average .DJI rose 13.01 points, or 0.06 percent, to 21,797.79, the S&P 500 .SPX lost 3.67 points, or 0.15 percent, to 2,461.43 and the Nasdaq Composite .IXIC dropped 37.68 points, or 0.59 percent, to 6,360.19.

Slideshow ( 3 images )

The tech sector .SPLRCT, which has outperformed all other major groups this year, ended down 0.9 percent. Shares of Apple AAPL.O were down 1.6 percent while shares of Facebook FB.O fell 1.3 percent.

Energy shares .SPNY fell 1.1 percent as oil prices dropped on worries that commerce and energy demand in Florida and the Southeast would be hit hard due to Irma.

Shares of Home Depot HD.N and Lowe's Cos LOW.N, which have gained amid of the arrival of the storms, rose on Friday. The stocks were up 1.1 percent each.

Major indexes all posted declines for the week after two weeks of gains. Geopolitical concerns kept investors on edge as South Korea prepared for a possible further missile test by North Korea on Saturday, days after its sixth and largest nuclear test.

“It’s a confluence of concerns that have been hovering over the market, everything from North Korea ... and obviously the hurricane and the damage that will ensue,” said Quincy Krosby, chief market strategist at Prudential Financial in Newark, New Jersey.

Despite those macro concerns, the benchmark S&P 500 still is within about 1 percent of its all-time closing high as investors point to strong corporate earnings and solid economic data as supporting stocks.

Slideshow ( 3 images )

Equifax EFX.N was the biggest percentage loser on the S&P, falling 13.7 percent, after the provider of consumer credit scores said personal details of as many as 143 million U.S. consumers were hacked.

Kroger KR.N shares ended down 7.5 percent after the biggest U.S. supermarket owner reported a quarterly profit drop amid an intensifying grocery price war.

Declining issues outnumbered advancing ones on the NYSE by a 1.19-to-1 ratio; on Nasdaq, a 1.01-to-1 ratio favored advancers.

About 6 billion shares changed hands in U.S. exchanges, above the 5.8 billion daily average over the last 20 sessions.