U.S. stocks closed their worst year since 2008 with a rally.

The S&P 500 (^GSPC) rose 0.85%, or 21.11 points, as of market close. The Dow (^DJI) advanced 1.15%, or 265.06 points, and shot up 137 points in the final minute of trading. The Nasdaq (^IXIC) edged higher by 0.77%, or 50.76 points, after briefly turning negative earlier in the session.

Despite Monday’s upturn, the three major indices closed the calendar year 2018 firmly in the red. As of market close, the S&P 500 was down 6.2%, the Dow was lower by 5.6% and the Nasdaq was down 3.9% for the year. The last time the indices closed a year lower was in 2008, when the S&P 500 fell 38.5%, the Dow slid 33.8% and the Nasdaq declined 40%.

Crude oil prices (CL=F) have also had a tumultuous 2018, posting their worst year since 2015. Domestic crude oil prices fell about 25% this year, turning around after jumping to a four-year high three months ago. Contracts for West Texas Intermediate crude oil rose 8 cents to $45.41 per barrel on Monday.

With risk assets pummeled in the fourth quarter of 2018, many investors have fled to so-called safe haven investments including gold (XAUUSD=X). The metal hit a high of $1,286.50 per ounce on Monday morning, the highest price since mid-June. And this year’s best-performing currency was the yen, also known for being a haven asset, which has outperformed both the pound and the euro as Brexit and Italy’s budget concerns weighed on the major European currencies. As of Monday, the yen was up more than 2.5% for the year at 109.88 per dollar, Bloomberg reported.

Monday’s session comes on the heels of a volatile holiday-shortened week for stocks, during which the Dow posted its worst Christmas Eve performance on record before skyrocketing more than 1,000 points during the next trading session on Wednesday.

A fresh dose of optimism for U.S.-China trade relations helped send equities higher on the final trading day of the 2018 calendar year. President Donald Trump over the weekend wrote in a Twitter post that he “had a long and very good call with President Xi [Jinping] of China. Deal is moving along very well…Big progress being made!”

New data from China pointed to the ongoing trade war’s impact on sentiment and stimulus to the economy heading into 2019. The country’s manufacturing purchasing managers index dropped to an about two-year low of 49.4 in December as new orders and input and output prices weakened. Readings of under 50 indicate contraction.

Traders work on the floor of the New York Stock Exchange (NYSE) in New York, U.S., December 28, 2018. REUTERS/Jeenah Moon More

Meanwhile, the U.S. government has entered its tenth day of a partial shutdown, with few signs of progress toward a deal that Congress and Trump would be willing to agree upon. Trump and congressional Democrats have been caught in an impasse over demands for $5 billion in funding for a southern barrier with Mexico, a central promise of Trump’s presidential campaign.

On Thursday, Nancy Pelosi (D-Calif.) is set to become Speaker of the House as Democrats take control over the House of Representatives. Congressional Democrats have been widely opposed to funding for the wall, and her challenge will be to pass a spending bill that appeases both her party’s and the president’s demands. Senate Majority Leader Mitch McConnell has said that his chamber will only vote on a deal that has all congressional leaders and the president’s support.

The stock market will be closed on Tuesday in observance of New Year’s Day.

2019 Outlook

2018 was a rollercoaster year for investors, but some analysts are optimistic that equities will push higher in 2019. John Stoltzfus, chief investment strategist for Oppenheimer, on Monday initiated a year-end 2019 price target for the S&P 500 of 2,960, or 16.9 times the firm’s 2019 earnings per share estimate of $175. The price target implies about 18% upside from the S&P 500’s closing price on Monday.