U.S. stocks rose Monday as big technology companies like Apple continued to rally.

Technology companies have set the pace all year and are up more than twice as much as the rest of the market. Apple and Facebook, which will report their first-quarter results in the next few days, helped lead the way.

advertisement | advertise on newsday

Investors were relieved that the threat of a government shutdown appears to have been averted, so they bought riskier stocks and sold government bonds, gold, and high-dividend stocks.

Technology companies and banks have stood out in the first quarter, said David Schiegoleit, the head of investments at U.S. Bank’s Private Client Reserve. He said many different types of technology companies are doing well, especially ones that cater to consumers. A key reason is that after years of trouble, economies outside the U.S. are improving.

“Emerging market economies are starting to get better momentum and we’re also starting to see some pretty decent activity out of Europe,” he said.

The Standard & Poor’s 500 index picked up 4.13 points, or 0.2 percent, to 2,388.33. The Dow Jones industrial average lost 27.05 points, or 0.1 percent, to 20,913.46 as Boeing and IBM lagged.

Thanks to the gains for technology companies, the Nasdaq composite rose 44 points, or 0.7 percent, to 6,091.60, and set another record high.