Some of the biggest companies in the world had their best day in years on Friday as Microsoft, Google and Amazon soared following strong third-quarter results.
US stocks set more records as their winning streak extended to a seventh week.
Intel made its biggest gains in three years while Microsoft had its biggest jump in two years and Alphabet, Google's parent company, made its largest move in more than a year after each company's results were better than Wall Street expected.
Amazon jumped 13%, its biggest move in two-and-a-half years, after it got a boost from its latest "Prime Day" promotion and the purchase of the Whole Foods grocery store chain.
"The transition to cloud computing really played a role in all of those tech results to some extent," said Brad Sorensen, the director of market and sector analysis for the Schwab Center for Financial Research.
Technology companies get a lot of their profits outside the US compared to other industries, so the improving global economy is helping them more.
Other stocks were mixed, as retailers fell after JC Penney cut its annual forecasts. Drug stores, drug makers, healthcare suppliers and pharmaceutical distributors and retailers also fell.
The Standard & Poor's 500 index rose 20.67 points, or 0.8%, to 2,581.07. The Dow Jones industrial average made a comparatively modest gain of 33.33 points, or 0.1%, to 23,434.19 as drug maker Merck and oil company Chevron skidded after their third-quarter reports.
The Nasdaq composite made its biggest gain since November as it soared 144.49 points, or 2.2%, to 6,701.26. The Russell 2000 index of smaller-company stocks picked up 10.86 points, or 0.7%, to 1,508.32.
The S&P 500 and Nasdaq finished at all-time highs. The S&P 500 also rose for the seventh consecutive week, something that had not happened since late 2014.
Bond prices jumped while the yield on the 10-year Treasury note fell to 2.41% from 2.46%, a seven-month high.