Strong gains for technology companies like software and chip makers helped lead US stocks higher Monday.
Defence contractors also climbed as the market continued to bounce back from a bout of turbulence last week.
Stocks rose for the third day in a row. Technology companies are closing in on all-time highs and continued to rise Monday, led by big names like Cisco Systems and Qualcomm.
Aerospace and defence companies rose after President Donald Trump presided over a huge sale of military equipment to Saudi Arabia.
Amazon led consumer-focused companies higher.
Energy companies lagged even though oil prices continued their recent climb.
Sameer Samana, a strategist for Wells Fargo Investment Institute, said people continue to spend more money on personal electronics while businesses invest in automation and software to boost their productivity.
"In a low-growth environment, you've got to squeeze more out of every dollar of investment," Samana said.
At the same time, he added, some overseas markets have been stronger than expected this year.
The Standard & Poor's 500 index jumped 12.29 points, or 0.5%, to 2,394.02.
The Dow Jones industrial average added 89.99 points, or 0.4%, to 20,894.83.
The Nasdaq composite gained 49.91 points, or 0.8%, to 6,133.62.
The Russell 2000 index of smaller-company stocks picked up 9.81 points, or 0.7%, to 1,377.14.
The technology component of the S&P 500 index has soared 18% this year, almost three times as much as the broader S&P 500.
On Monday chipmaker Qualcomm gained 1.61 dollars, or 2.8%, to 59.28 dollars and Cisco Systems, which sells equipment like routers, switches and software, rose 38 cents, or 1.2%, to 31.59 dollars.
Adobe Systems picked up 2.42 dollars, or 1.8%, to 138.85 dollars and design software maker Autodesk jumped 3.45 dollars, or 3.1%, to 113.36 dollars.
Both the S&P 500 and tech-heavy Nasdaq composite set records early last week before worries about growing political uncertainty in Washington, which could hamper President Trump's agenda of tax cuts and deregulation, knocked those indexes back from their highs.
The Russell 2000 of smaller companies, which would benefit more than large ones from Mr Trump's proposals, is down 3% from the record it set a month ago.
Samana said he thinks stocks will become more volatile in the coming months, but not because of politics.
Instead, he thinks stocks will break out of their unusual calm because the Federal Reserve and European Central Bank will pull back on the stabilising measures they have used since the global financial crisis.
"If they both start to lay the groundwork for pulling back on the extraordinary stimulus, that's probably the catalyst for a little bit more volatility," he said.
Aerospace and defence companies climbed after Mr Trump presided over a 110 billion dollar sale of military equipment to Saudi Arabia.
The agreement could expand to 350 billion dollars over 10 years. Lockheed Martin climbed 4.24 dollars, or 1.6%, to 277.03 dollars and Boeing gained 2.91 dollars, or 1.6%, to 183.67 dollars.
Amgen and its partner UCB said women who took their experimental osteoporosis drug Evenity were more likely to have serious cardiovascular problems than patients who took Fosamax, an older drug.
The companies said that was a new safety concern and they no longer expect the Food and Drug Administration to approve Evenity this year. Amgen lost 3.49 dollars, or 2.2%, to 153.02 dollars.
Ford replaced chief executive Mark Fields as it struggles to keep the traditional parts of its business running smoothly while it tries to remake itself as a nimble, high-tech automaker.
In Fields' three years as chief executive, popular cars like the Fusion sedan became dated and Ford lagged competitors in bringing long-range electric cars to market.
Ford's new CEO is Jim Hackett, who has led Ford's mobility unit for more than a year.
Ford added 23 cents, or 2.1%, to 11.10 dollars. The stock is down 8.5% this year.
US-based Huntsman and Swiss speciality chemicals maker Clariant are merging to create a company with a market value of 13.8 billion dollars. The company will call itself HuntsmanClariant and Clariant shareholders will own 52% of the new company.
Huntsman stock slid 56 cents, or 2.1%, to 26.15 dollars and Clariant stock rose 3.4% in Switzerland.
Bond prices moved a bit lower. The yield on the 10-year Treasury note inched up to 2.25 % from 2.24 % .