(Reuters) - Major U.S. stock indexes ended a volatile week on a modestly high note on Friday, led by a surge in Nike shares, and the S&P 500 scored its biggest gain for the first half of the year since 2013 while the Nasdaq Composite’s first-half gain was its best in eight years.

Traders work on the floor of the New York Stock Exchange shortly after the opening bell in New York, U.S., June 27, 2017. REUTERS/Lucas Jackson

Nike shares NKE.N rose 11 percent on Friday after the world's largest footwear maker said it would launch a pilot online sales program with Amazon.com AMZN.O. Nike shares gave the biggest boost to the Dow industrials and the S&P 500.

Even as technology shares limped through June, the sector has been the big story of the first six months of the year. Tech shares gained 16.4 percent in the first-half, double the S&P 500’s 8.2 percent rally so far this year. The tech-heavy Nasdaq surged 14.1 percent in the first half.

The S&P technology index .SPLRCT ended down 0.1 percent on Friday, while for all of June it posted its first monthly loss of the year. A decline in biotech shares .NBI, which had surged of late, also limited the Nasdaq.

“Are we going to see a broadening of the rally, where you see more of the financials and other sectors fill in some of the gaps?” said Alan Lancz, president of Alan B. Lancz & Associates Inc, an investment advisory firm in Toledo, Ohio.

“It hasn’t been a broad encompassing rally, that I think investors will have to see a little bit more conviction rather than just in a handful of stocks,” Lancz said.

The Dow Jones Industrial Average .DJI rose 62.6 points, or 0.29 percent, to 21,349.63, the S&P 500 .SPX gained 3.71 points, or 0.15 percent, to 2,423.41, and the Nasdaq Composite .IXIC dropped 3.93 points, or 0.06 percent, to 6,140.42.

Industrials .SPLRCI were the top-performing sector, rising 0.8 percent.

“When you look at some of the stocks that are doing particularly well today, they are some of those economically sensitive-type stocks,” said Chuck Carlson, chief executive officer at Horizon Investment Services in Hammond, Indiana.

“During a time when it seems like there are still a fair amount of naysayers out there about the economy and GDP, anytime you get some of those stocks showing some strength, it probably emboldens the market,” Carlson said.

The S&P 500’s percentage gain in the first half was its biggest since climbing 12.6 percent in the first six months of 2013. The Nasdaq posted its biggest first-half gain since 2009.

U.S. consumer spending rose modestly in May and inflation cooled, pointing to a slow-but-steady economic expansion. The Commerce Department data bolstered the view that the U.S. economy is rebounding in the second quarter.

Investors have been concerned about recent mixed economic data at a time that the Federal Reserve begins lifting interest rates from very low levels.

The release of second-quarter corporate results is set to begin in earnest in the coming weeks, with S&P 500 companies expected to post an 8 percent rise in earnings, according to Thomson Reuters I/B/E/S.

Investors have been looking for earnings to support historically high valuations. The S&P 500 has been trading at about 18 times earnings estimates for the next 12 months compared with the long-term average of 15 times.

“We can talk about the economy and geopolitical risk but earnings drive the market,” said Chris Bertelsen, chief investment officer of Aviance Capital Management in Sarasota, Florida. “We’re bumping right along the top end of” historic valuation levels.

About 6.6 billion shares changed hands in U.S. exchanges, below the 7.3 billion daily average over the last 20 sessions.

Advancing issues outnumbered declining ones on the NYSE by a 1.60-to-1 ratio; on Nasdaq, a 1.01-to-1 ratio favored decliners.