(AP) -- Wall Street closed the books Tuesday on a blockbuster 2019 for stock investors, with the broader market delivering its best returns in six years.
The S&P 500 finished with a gain of 28.9% for the year, or a total return of 31.5%, including dividends. The Nasdaq composite rose 35.3%. For both indexes it was the best annual performance since 2013. Technology stocks helped power those gains by vaulting 48%.
The Dow Jones Industrial Average gained 22.3%, led by Apple.
Along the way, the three major indexes set more record highs than in 2018 and kept the longest bull market for stocks going.
"We had a remarkable year of returns in the stock market," said Keith Buchanan, portfolio manager at Globalt Investments. "Things are much different going into 2020 than they were going into 2019."
Wall Street's record-shattering ride in 2019 was not without its bumps.
The market got off to a roaring start in January after Federal Reserve Chairman Jay Powell said the central bank would be "patient" with its interest rate policy following four increases in 2018. That encouraged investors who had been worried the Fed would continue hiking rates. Those concerns helped fuel a sell-off in the final quarter of 2018 that knocked the S&P 500 nearly 20% lower by December of that year.
January's rally helped set the tone for a year in which the market responded to every downturn with a more sustained upswing. Along the way, stocks kept setting records — 35 of them for the S&P 500 index, 22 for the Dow and 31 for the Nasdaq.
By the end of the year, the Fed had completely reversed course and cut rates three times in what Powell called a pre-emptive move against any impact a sluggish global economy and the U.S.-China trade war might have on U.S. economic growth.
The market also overcame a late-summer slump caused by fears that the U.S. economy could be headed for a recession. Those concerns eased as investors drew encouragement from surprisingly good third-quarter corporate earnings and data showing the economy was not slowing as much as economists had feared.
"You fast-forward 12 months and now we're going into 2020 and the sentiment seems like it's fairly the opposite," Buchanan said. "There are fairly rosy expectations and there's not a consensus that a recession is coming in a very near term."
A truce in the 17-month U.S.-China trade war helped keep investors in a buying mood through the end of the year. Washington and Beijing announced in December they reached an agreement over a "Phase 1" trade deal that calls for the U.S. to reduce tariffs and China to buy larger quantities of U.S. farm products.
On Tuesday, President Donald Trump tweeted that he will sign the initial trade deal with China at the White House next month. He also said he plans to travel to Beijing at a later date to open talks on other sticking points in the U.S.-China trade relationship that remain to be worked out, including Chinese practices the U.S. complains unfairly favor its own companies.
A last-minute burst of buying reversed an early dip the major indexes Tuesday. Stocks ended the day broadly higher, led by gains in technology, health care and financial companies. Industrial stocks and household goods makers lagged the most. Bond prices fell, sending yields higher. Gold rose and crude oil fell.
The S&P 500 rose 9.49 points, or 0.3%, to 3,230.78. The Dow gained 76.30 points, or 0.3%, to 28,538.44. The Nasdaq climbed 26.61 points, or 0.3%, to 8,972.60.
Smaller company stocks fared better than the rest of the market. The Russell 2000 index picked up 4.32 points, or 0.3%, to 1,668.47. The index ended the year with a gain of 23.7%.
Trading volume was lighter than usual ahead of the New Year's Day holiday. U.S. markets will be closed Wednesday and reopen on Thursday.
Bond prices fell. The yield on the 10-year Treasury note rose to 1.92% from 1.89% late Thursday.
In a year when most of the 11 sectors in the S&P 500 finished with gain of more than 20%, technology stocks led the way higher.
"Technology performed well," said J.J. Kinahan, chief strategist with TD Ameritrade. "There was a huge fear going into the year that technology was going to suffer considerably because of tariffs, yet at the end of the year Apple is the leading stock in the Dow."
Apple did in fact precipitate one of the biggest sell-offs of the year on Jan. 3 with a warning of slowing demand for iPhones. After that, however, it was mostly good news for Apple shareholders and the stock finished with an annual gain of 86%, its best year since 2009.
Financial sector stocks, especially big banks, also posted strong gains in 2019, despite a sharp pullback in interest rates.
The sector ended with a 29.2% gain for the year, while JPMorgan Chase, Bank of America and Citigroup climbed over 40%.
Benchmark U.S. crude oil lost 62 cents to settle at $61.06 per barrel. Brent crude, the international standard, gave up 67 cents to close at $66 per barrel.
In other commodities trading, wholesale gasoline fell 3 cents to $1.70 per gallon. Heating oil slipped a penny to $2.03 per gallon. Natural gas was little changed at $2.19 per 1,000 cubic feet.
The price of gold rose $5 to $1,519.50 per ounce. Silver fell 8 cents to $17.83 per ounce. Copper dropped 3 cents to $2.79 per pound.
The dollar fell to 108.64 Japanese yen from 108.83 yen on Monday. The euro strengthened to $1.1217 from $1.1202.
European markets closed mostly lower. In Asia, Hong Kong's Hang Seng index lost 0.5%.
By ALEX VEIGA AP Business Writer
Read the Top 8
Sign up for the Top 8, a roundup of the day's top stories delivered directly to your inbox Monday through Friday.