Stocks rose on Tuesday, but sentiment on Wall Street was dampened by lingering fears that the economy is slowing down.

The Dow Jones Industrial Average closed 140.90 points higher at 25,657.73. The 30-stock index rose as much as 279.46 points earlier in the day. The closed up 0.7 percent at 2,818.46 — notching its first gain in three sessions — after trading 1.1 percent higher at its high of the day. The Nasdaq Composite gained 0.7 percent to close at 7,691.52.

Bank shares outperformed as the SPDR S&P Bank ETF (KBE) gained more than 2 percent. Citigroup, Bank of America, Goldman Sachs, Morgan Stanley and J.P. Morgan Chase all rose more than 1 percent.

The major averages pared their gains along with the benchmark 10-year Treasury yield. The benchmark rate sat at 2.42 percent in afternoon trading, about 3 basis points below its session high. That move comes a day after reaching its lowest level since December 2017. The 10-year's decline caused a so-called yield-curve inversion as the 3-month Treasury bill yield moved above the benchmark rate. Investors see a yield-curve inversion as a signal that a recession may be on the horizon, so a rise in long-term rates is being viewed as a positive right now.

The yield curve inverted amid the release of weak economic data from the U.S. and around the world as well as a downgraded U.S. economic outlook from the Federal Reserve.

"There's lots of angst about global economic growth. That's understandable because it has been slowing significantly since early 2018," Ed Yardeni, president and chief investment strategist at Yardeni Research, wrote in a note. "Furthermore, we can all observe that ultra-easy monetary and debt-financed fiscal policies aren't as stimulative as policymakers have been hoping."