The S&P 500 advanced 0.8% to close at a record high, while the Nasdaq Composite surged 1.7% to its own all-time peak, aided by strong gains in technology stocks. The Dow Jones Industrial Average ended largely flat, adding 12.19 points, or 0.02%, to settle at 49,609.16.