US stock indices closed higher on Friday as gains in major technology stocks lifted the market late in a volatile session.

The S&P 500 rose 0.7%, the Nasdaq gained 0.6%, and the Dow added 277 points.

Amazon jumped 15.3% on strong cloud growth.

Optimism around the AI trade boosted software and hyperscalers, with Alphabet gaining 6.7%, Microsoft adding 3%, and Meta rising 3.3%.

Those gains outweighed a decline in Apple (-7.3%), after chip shortages raised costs and reduced June-quarter production, weighing on earnings.

Elsewhere, broader sectors were weaker, with Netflix down 2% and Eli Lilly losing 0.5%.

The 30-year Treasury yield climbed further on concerns that Kevin Warsh's FOMC may refrain from raising rates to curb inflation.

Meanwhile, ExxonMobil fell 1% as limited refinery capacity prevented the oil major from fully benefiting from higher oil prices last quarter.