- The 30-stock index finished just above the flatline, while Travelers rose 2.4 percent and was the biggest contributor to the gains on the Dow.
- The Dow had fallen 104.93 points at its session lows.
- Thursday also marked the 30th anniversary of "Black Monday," the worst day in U.S. stock-market history.
The Dow Jones industrial average eked out a record close on Thursday, erasing sharp losses, as Wall Street bet on further gains from corporate earnings.
The 30-stock index finished 5.44 points higher at 23,163.04, while Travelers rose 2.4 percent and was the biggest contributor to the gains on the Dow. Travelers reported earnings per share that easily beat expectations.
The Dow had fallen 104.93 points at its session lows. Tech giant Apple saw its stock decline 2.5 percent, amid speculation of poor demand and cuts in production of iPhone 8. The stock was also posted its biggest one-day decline since Aug. 10.
The also erased its losses to manage a record close at 2,562.10, as a 12.2 percent gain in Adobe shares offset steep losses from United Continental. The airline's stock fell 12.1 percent.
The Dow and the S&P 500 rose slightly into the close after Politico reported that President Donald Trump was leaning toward Federal Reserve Governor Jerome Powell to be the next head of the central bank. Appointing Powell as the Fed chair would represent a continuation of the central bank's current regime.
The Nasdaq composite lagged, falling 0.3 percent to 6,605.07. Facebook, Google-parent Alphabet, Netflix and Amazon all finished lower.
Thursday also marked the 30th anniversary of "Black Monday," the worst day in U.S. stock-market history. On that day, the S&P 500 plunged 20.5 percent and the Dow dropped 22.6 percent.
"You could make the argument that another major pullback like that could happen, but interest rates are not where they were then and inflation is still low," said Peter Cardillo, chief market economist at First Standard Financial.
CFRA strategist Sam Stovall said in a note this week the S&P's daily price chart this year looks "eerily" like that of 1987, but that's about the only similarity between the market then and now.
Since the crash, the Dow has averaged a gain of 0.19 percent on Oct. 19 with positive returns two-thirds of the time, according to Bespoke Investment Group.
U.S. stock futures fell Thursday before the open, with Dow futures briefly pulling back more than 100 points, as they followed European equities lower.
The major European stock indexes fell after the Spanish government suspended Catalonia's autonomy after regional leader Carles Puigdemont failed to drop a bid for independence.
The Spanish Ibex 35 index fell 0.7 percent, while Italy's FTSE MIB declined 1 percent. The French CAC 40 and the Germany's Dax pulled back 0.3 percent and 0.4 percent, respectively.
"The biggest risk with the Spain situation is a contagion to Italy," said Larry McDonald, head of the U.S. macro strategies at ACG Analytics and editor of The Bear Traps Report. "If you're a separatist in Italy, this will empower you."
The move lower in European equities followed declines in Hong Kong and China stocks. The Hang Seng index and Shanghai composite fell 1.9 percent and 0.35 percent after People's Bank of China Governor Zhou Xiaochuan warned of a sudden collapse in asset prices.
Wall Street also continued to digest corporate earnings reports.
EBay reported better-than-expected quarterly revenue along with earnings per share that met expectations. However, the company reported mixed guidance for the fourth quarter, sending the stock down 1.8 percent.
Philip Morris also reported quarterly earnings, but fell short of expectations; its stock dropped 3.8 percent.
This earnings season is off to a good start, with 73 percent of companies reporting better-than-expected quarterly earnings and revenue, according to Thomson Reuters I/B/E/S.
"So far so good, but I think it's too early to declare victory," said Scott Clemons, chief investment strategist at Brown Brothers Harriman. "We haven't heard from a lot of companies yet. We haven't even heard from a lot of sectors yet."
—Reuters contributed to this report.