There were no fireworks on Wall Street for the last trading day of the year, as U.S. stocks closed out their best year since 2013 on a down note, with losses in technology and financial stocks keeping equities in negative territory for the session.

Major indexes hit a series of record highs in 2017, lifted by a combination of strong economic growth, solid corporate earnings, low interest rates and hopes for a tax cut from U.S. President Donald Trump's administration.

The benchmark S&P 500 surged 19.5 percent this year, the blue-chip Dow 25.2 percent and Nasdaq 28.2 percent, as each of the major Wall Street indexes scored the best yearly performance since 2013.

The market has also remained resilient in the face of tensions in North Korea and political turmoil in Washington. The S&P 500 only saw four sessions all year with a decline of more than 1 percent while the CBOE Volatility index topped out at 15.96 on a closing basis, well below its long-term average of 20.

"The real question is what happens as we head into 2018," said Sam Stovall, chief investment strategist at CFRA Research in New York.

"There is an awful lot of optimism built into share prices right now that could set us up for disappointment."

Among sectors, the technology index has been the best performer, up 37 percent and led by a gain of 87.6 percent in Micron Technology.

Telecom services, down 5.7 percent, and energy , down 3.7 percent, were the only two sectors to end the year in the red.

The rally is widely expected to extend into 2018, boosted by gains from a new law that lowers the tax burden on U.S. corporations.

The Dow Jones Industrial Average fell 118.29 points, or 0.48 percent, on Friday to close at 24,719.22, the S&P 500 lost 13.93 points, or 0.52 percent, to 2,673.61 and the Nasdaq Composite dropped 46.77 points, or 0.67 percent, to 6,903.39.

For the week, the Dow lost 0.13 percent, the S&P 500 shed 0.36 percent and the Nasdaq lost 0.81 percent.

Apple declined 1.08 percent after issuing a rare apology for slowing older iPhones with flagging batteries.

Goldman Sachs lost 0.68 percent after saying its fourth-quarter profit would take a $5 billion hit related to the new tax law.

Amazon fell 1.4 percent after Trump targeted the online retailer in a call for the country's postal service to raise prices of shipments in order to recoup costs.

Declining issues outnumbered advancing ones on the NYSE by a 1.46-to-1 ratio; on Nasdaq, a 1.91-to-1 ratio favored decliners.

The S&P 500 posted 36 new 52-week highs and no new lows; the Nasdaq Composite recorded 81 new highs and 20 new lows.

Volume on U.S. exchanges was 4.94 billion shares, compared to the 6.4 billion average for the full session over the last 20 trading days.