For politics, global relations and the climate, 2017 was a year of turmoil. Partisan divisions in Washington, escalating threats from North Korea and historic natural disasters left many Americans hoping they’ll be dealt a better hand in the coming year.

But on Wall Street, everything came up aces.

Seemingly indifferent to the chaos and belying many experts’ predictions, stock markets had their best year since 2013, with the closely watched Dow Jones industrial average ending 2017 up a staggering 25 percent.

The steady rise has generated trillions in gains for investors as Wall Street banked on strong corporate profits, global economic strength and Republican efforts — led by President Trump — to cut business taxes and curb regulations.

Many analysts say it is unlikely that 2018 will match this year’s performance, though there is little consensus on how and when a pullback might occur. A sell-off could be triggered by the shock of some unforeseen global event, a trade war, a rise in inflation or a jump in interest rates that remain at historic lows. For now, though, events that might once have spooked the market don’t seem to have the same effect.

Rising U.S. tensions with North Korea, an economic slowdown in China, the fallout from Britain’s decision to leave the European Union and even a special prosecutor investigation into Russian meddling in the 2016 election failed to shake markets, analysts said. Stocks continued to climb even as three hurricanes caused massive damage to the United States and its territories and as the Trump administration struggled to pass key legislative goals, such as repealing the Affordable Care Act.

“Nothing seems to get in the way. All sorts of things that would have held back investors before are not now,” said Art Hogan, chief market strategist at the investment bank B. Riley FBR.

Investors “just don’t believe that we’re going to war with North Korea, or they believe that it will be a quick one,” added Jeff Carbone, a financial adviser with Cornerstone Financial Partners. “Whether you call it confidence or complacency, it seems like investors are just shrugging off geopolitical issues.”

Many on Wall Street expect the stock markets to be propelled forward in 2018 by the recently adopted tax bill that lowered the corporate tax rate to 21 percent from 35 percent and trimmed taxes for many individuals, giving the biggest cuts to the wealthy. In the past, studies show, companies often returned the savings to investors in the form of share buybacks and dividends.

The stock market’s gains have come alongside broader economic improvements, as unemployment has been steadily dropping for more than five years, to a rate not seen in 16 years, and consumer confidence reached a 17-year high last month.

Not everyone, though, has shared in the wealth. While investors saw their retirement accounts mushroom, nearly half the country has no money invested in pension funds, retirement plans, mutual funds or individual stocks, according to the Federal Reserve and numerous surveys by groups such as Gallup and Bankrate.

“What we have is a big inequality problem in the United States that has not been getting better,” said James J. Angel, a Georgetown University finance professor.

Analysts are divided about how long the good fortune can last, particularly because the country has rarely gone this long without some type of a pullback. The stock market has been climbing steadily since the country came out of the Great Recession in 2009. It surged anew following Trump’s election amid his promises to cut taxes and remove regulations on energy, manufacturing and other industries. The Dow Jones industrial average, a widely followed average of the stocks of 30 major corporations, stood at about 18,000 on Election Day. It approached 25,000 this week.

“70 Record Closes for the Dow so far this year! We have NEVER had 70 Dow Records in one year period. Wow!” Trump said in one recent tweet; the Dow broke its own record shortly afterward.

The S&P 500, an even broader reflection of the market, posted nine straight months of increases to climb 20 percent for the year, and the tech-heavy Nasdaq posted similar gains.

The run-up in stock prices has already added $6.6 trillion in market value since the election to companies that make up another broad index, the Wilshire 5000.

The steady rise has befuddled some veteran traders who say it can’t be explained by traditional metrics and could leave the economy exposed to blind spots.

Some investors appear to be ignoring the normal warning signals for fear they could miss out on more profits if they sell now, market analysts said.

“A year ago, even if you were optimistic about Trump policies, you wouldn’t have expected markets to be this calm,” said Ryan Detrick, senior market strategist for LPL Financial.

Some market analysts say that when stock prices inevitably begin to fall, the decline could be more dramatic than it has been in the past. If the tax bill does not generate the kind of economic growth Republicans expect, for example, it could spark a move by investors to cash in their profits. Or the economy could heat up too fast, driving up inflation and prompting investors to sell.

There are other dangers. The Trump administration has vowed to take an “America first” stance in renegotiating trade accords, a move that could spark retaliation. Talks to update the North American Free Trade Agreement have bogged down over Trump’s demands for concessions from Mexico and Canada involving traditional industries such as automobile manufacturing.

The administration also is pursuing a host of trade cases seeking tariffs on foreign distributors it claims receive improper subsidies from their governments. Business groups worry the move could spark a costly battle with China. The White House is preparing to act on petitions from U.S. companies seeking tariffs and quotas on Chinese solar panels and washing machines manufactured in China and its neighbors; it is also weighing what to do about Chinese steel and aluminum imports.

Interest rates also bear watching. The Federal Reserve, under Chair Janet L. Yellen, has started pulling back on the actions it used to resuscitate the economy. Yellen said during her final news conference this month, “There’s less to lose sleep about now than has been true for quite some time.”

Among the actions it is taking is gradually raising interest rates, which remain at historic lows. Yellen, who is stepping aside next year, said increasing rates could create volatility in the markets, putting corporate profits at risk.

International tensions beyond North Korea remain: Britain is preparing to exit from the European Union, and elections overseas could have economic implications.

Then there are new issues, such as the sudden rush to crypto­currencies such as bitcoin, which has sent its value soaring one day and falling sharply the next.

So far those types of currencies “are not owned by enough people yet to have the housing-crisis-like effect,” said Jamie Cox, managing partner at Harris Financial Group. “But there are a lot of people doing stupid things to buy cryptocurrencies, like putting mortgages on their house to buy bitcoin. It should inevitably have its crash and have its effect on the market a few years down the road.”

For now, people appear prepared to see past whatever uncertainty the new year brings in the hope of future opportunities to cash in, maybe more so than they did this year.

“Investors’ sentiment has moved from skepticism last year to optimism this year,” said Marc Pouey, a strategist at Bank of America Merrill Lynch. “We think that might move into euphoria next year.”

The glee will have to wait, at least until Tuesday. On the last day of trading in 2017, the Dow finished down 0.48 percent to close at 24,719.22.