The S&P 500 also gained amid a court victory for Big Tech that saw Alphabet Inc.’s Google dodging a sale of its Chrome web browser.