TORONTO -- Major equity markets in Toronto and New York capped off a strong performing year Thursday with a whimper, much like how it began 2016, as most commodities softened.

The S&P/TSX composite index, which had been flat at the start of the session, lost 134.53 points at 15,287.59 by day's end -- weighed down by a broad decline in nearly all sectors with the biggest losses coming from gold, materials and metals stocks.

But even though the commodity-heavy index finished 2016 in the red, its journey this year has been an upwards ride firmly into the black.

The S&P/TSX has been one of the best performing stock markets among developed countries, gaining 17.5 per cent this year, compared with a closing price of 13,009.95 at the end of last year.

It's an outcome that barely anyone could've predicted.

"This has been, I don't want to say, a strange year, but expect the unexpected," said Allan Small, a senior adviser at HollisWealth.

"The markets seem to just power through everything. It's quite amazing how the markets just seems to move forward."

This time last year, there was little hope in energy, gold or bank stocks -- three sectors that make up 75 per cent of the TSX/S&P.

But then, sometime around February, these sectors took a turn for the better as investors became more comfortable with the idea of the U.S. Federal Reserve hiking interest rates. The central bank eventually didn't raise rates until earlier this month.

The continually low-rate environment has helped fuel both the Toronto and the U.S. stock markets, as investors flock to equities for growth with little alternatives in sight.

On Wall Street, the Dow Jones industrial average lost 57.18 points to 19,762.60. The broader S&P 500 was down 10.43 points to 2,238.83, while the Nasdaq composite declined 48.97 points to 5,383.12.

Small noted that North American stock markets have shown surprising resilience to unexpected global economic events, such as the British exit vote from the European Union, the election of Donald Trump as U.S. president and the oil production cuts agreed to by OPEC and non-OPEC members.

The continued rally that was ignited following Trump's victory on Nov. 8 is expected to likely continue into 2017, as investors stay optimistic about the millions of dollars he's promised to inject into U.S. infrastructure and the loosening of regulations in the banking and pharmaceutical sectors.

"The markets are rallying based on hope, hope that what Donald Trump and the Republicans are saying they can do and will do, will happen," Small said.

The Canadian dollar was the one bright spot on Thursday, adding nearly half a cent, or 0.45 of a U.S. cent, to 74.48 cents US. It has racked up 2.23 U.S. cents this year.

In commodities, the February contract for crude retracted five cents to US$53.72 per barrel, but the commodity is still up 45 per cent from US$37.04 a barrel at the end of 2015.

The February gold contract fell $6.40 to US$1,151.70 an ounce, February natural gas dipped eight cents to US$3.72 per mmBTU, and March copper gained two cents to US$2.51 per pound.