NEW YORK - The S&P 500 and Dow Jones Industrial Average climbed on Friday, as the Dow put to rest an eight-day losing streak with a boost from energy stocks, but losses in the technology space kept the Nasdaq in check.

U.S. crude settled up 4.6 percent at $68.58 a barrel and Brent settled 3.4 percent higher at $75.55 after oil producers agreed to modest crude output increases to compensate for losses in production at a time of rising global demand.

Exxon Mobil rose 2.1 percent and Chevron gained 2.0 percent, as the two biggest boosts to the S&P. The S&P energy index was up 2.2 percent, as the sector notched its strongest day in June.

A rally in oil prices due to OPEC's earlier decision to restrict supply in an effort to drain global inventories has given the sector a gain of more than 11 percent for the quarter-to-date, best among the 11 major S&P groups.

"That is the big news of the day, both the OPEC news and just the reaction of the stocks as well," said Tim Ghriskey, Chief Investment Strategist at Inverness Counsel in New York, New York.

The Dow Jones Industrial Average rose 119.19 points, or 0.49 percent, to 24,580.89, the S&P 500 gained 5.12 points, or 0.19 percent, to 2,754.88 and the Nasdaq Composite dropped 20.14 points, or 0.26 percent, to 7,692.82.

For the week, the Dow lost 2 percent, its weakest weekly performance since late March. The S&P 500 fell 0.9 percent and the Nasdaq declined 0.7 percent.

Trade worries still loomed, however, as U.S. President Donald Trump, in his latest move, threatened to impose a 20 percent tariff on all European Union car imports. The announcement came a month after the administration launched a probe into whether auto imports pose a threat to national security.

"Certainly the longer it drags out, the market is bound to see some pressure, at least in some sectors and with certain companies," said Ghriskey.

Harley-Davidson fell 2.3 percent. The U.S. motorbike maker has in the past warned of a "significant impact" on its sales if the European Union decides to increase duties on motorcycles in retaliation. The S&P autos & components index dipped 0.5 percent.

This adds to worries about the China-U.S. trade spat which escalated this week after Trump threatened to impose tariffs on $200 billion of Chinese imports and Beijing vowed to retaliate.

Leading the decliners among tech was open source software provider Red Hat Inc, which tumbled 14.2 percent after its current-quarter and full-year revenue missed analysts' estimates due to a strengthening dollar.

Microsoft's 0.72 percent decline and Nvidia's 2.40 percent fall also weighed.

The trade spat has pushed the Dow Jones index lower for the past eight sessions as big industrial companies such as Boeing and Caterpillar have weighed on the index and put it on pace for its worst weekly performance in 13 weeks.

The latter stages of Friday's trading brought a surge of volume ahead of FTSE Russell's reconstitution of its indexes, finalized after the market close.

Advancing issues outnumbered declining ones on the NYSE by a 2.05-to-1 ratio; on Nasdaq, a 1.16-to-1 ratio favored advancers.

The S&P 500 posted 19 new 52-week highs and two new lows; the Nasdaq Composite recorded 115 new highs and 41 new lows.

About 9.70 billion shares changed hands in U.S. exchanges, well above the 7.17 billion daily average over the last 20 sessions. (Additional reporting by Sinead Carew Editing by Chizu Nomiyama and James Dalgleish)

© Reuters News 2018