The Standard & Poor’s 500, a broad slice of the stock market, rose less than 1 percent, but that was enough to push the index above 2134.72 — the intraday high set last May. (Eric Thayer/Bloomberg)

A closely watched market indicator reached a new high Monday, the latest sign of U.S. investors’ willingness to shrug off global turmoil.

The Standard & Poor’s 500-stock index, a broad slice of the stock market, rose less than 1 percent, but that was enough to push it to 2143.16, beating the previous intraday high of 2134.72 set in May 2015. The index broke another record by closing above its all-time high of 2130.82.

“It’s been a long haul” to reach those records, said Mike Mullaney, chief investment officer at Fiduciary Trust.

The records are a psychological victory for market watchers rather than a practical one. But they reflect a remarkable turnaround in U.S. markets this year. As 2016 commenced, stocks tumbled for weeks as investors fretted over the strength of China’s economy and falling oil prices. Global equities had all but climbed back from those losses when a fresh shock hit: Britain’s vote to leave the European Union, known as Brexit, sent markets worldwide into another tailspin.

But now oil prices have begun to rise, and the weakness in China’s economy does not appear as dire, analysts said. That has allowed stocks to claw back into record territory, boosted by investors’ confidence in the relative strength of the U.S. economy despite global turmoil. For example, the U.S. jobs market added a better-than-expected 287,000 jobs in June, allaying fears that the economy was headed for a sustained slowdown. Also, the turmoil overseas has made U.S. markets a relative safe haven for investors, analysts said.

On Monday, the S&P gained 0.3 percent to close at 2137.16. The Dow Jones industrial average, which tracks 30 large stocks, and the tech-focused Nasdaq rose about 0.4 percent and 0.6 percent, respectively.

Technology and banking stocks were among those that raced up the fastest. Goldman Sachs and Alphabet, the parent company of Google, were up more than 1 percent. Boeing rose 1.5 percent, making it the best performer on the Dow.

The S&P and the Dow are now up nearly 5 percent this year. The Nasdaq is still trading in negative territory, but just slightly.

“The fact that we have been able to sustain a rally means that it’s real, it may have legs,” said Brad McMillan, chief investment officer of Commonwealth Financial Network, which manages more than $100 billion in investments.

But mom-and-pop investors should be careful, analysts said. Stocks are still valued highly compared with historical norms and will face another big test over the next few weeks as U.S. companies report their second-quarter revenue and profit figures.

“The average investor should tread with caution. They shouldn’t race to up that exposure” in stocks, McMillan said.

S&P 500 companies are expected to report a 5.3 percent decline in second-quarter profits compared with the same period last year, according to S&P Global Market Intelligence. That would represent the first time since 2009 that the S&P 500 recorded a year-over-year earnings decline in four successive quarters.

A significant decline in corporate profits could unnerve investors, who will also be watching closely for indications that Brexit could weigh significantly on U.S. companies.

“Earnings are key. We all know they’re lousy in” the second quarter, said Jack Ablin, chief investment officer at BMO Wealth Management.