U.S. markets opened in the green across the board on the final day of trading in 2017, but then quickly shifted gears. 

The Nasdaq led the late morning selloff that saw all three major indices close trading on Friday deep in the red.

The Nasdaq fell 0.67%, or 47 points in the session, the Dow Jones Industrial Average declined 0.48%, or 118 points and the S&P 500 fell 0.52%, or 14 points, on the day.

All three major indices closed trading at their session lows.

Friday's close runs counter to the direction markets went this year, with each index setting multiple record highs throughout the year.

The Dow still had its best year of trading since 2013. The blue-chip index has risen more than 27% this year. Meanwhile, the S&P 500 has soared 20% and the Nasdaq has spiked about 30%. 

Bitcoin prices rebounded a bit from weakness on Thursday, breaking back above $14,000. The digital currency was up 1.2% to $14,607 as of 1:00 p.m. EST. 

Shares of The Goldman Sachs Group Inc. (GS)  fell 0.68%, or $1.74, to $254.76 after the company said that it would take a $5 billion one-time charge due to the GOP tax overhaul bill. 

Two-thirds of the charge will stem from repatriation taxes when the lender brings overseas money home. The rest of the charge is attributable to the "effects of the implementation of the territorial tax system and the remeasurement of U.S. deferred tax assets at lower enacted corporate tax rates."

Goldman joins British lender Barclays  (BCS) in forecasting a billion-dollar charge due to the new law. Barclays said that it expects to record a one-time charge of $1.3 billion.

European markets edged higher in a holiday-shortened trading session Friday.

In Europe, the euro, was marked 0.45% higher against a weaker U.S. dollar and trading at a three-month high of 1.1986 -- extending a year-to-date gain of 14% the best since 2003. 

Overnight in Asia, oil prices jumped to a fresh two-and-half-year high. That lifted U.S. crude past $60 a barrel following data from the Energy and Information Administration, which showed a 4.6 million barrel drop in domestic stocks and a slowing of production to around 9.754 million barrels per day.

The moves, as well as the consistent bullish tone in broader global commodities markets, kept pressure on the U.S. dollar index, which measures the greenback against a basket of six global currencies, and pushed it closer to a four-week low of 92.52. 

More of What's Trending on TheStreet:

More from Markets

Why Jim Cramer Isn't Surprised By the Jobs Report

Why Jim Cramer Isn't Surprised By the Jobs Report

What to Expect From the Markets in 2019 According to an Abbott Downing Executive

What to Expect From the Markets in 2019 According to an Abbott Downing Executive

Illinois Tool Works Stock Falls Despite In-Line Earnings Guidance

Illinois Tool Works Stock Falls Despite In-Line Earnings Guidance

Dow Falls For Third Day, Loses 4.4% in Week on Jobs Report, Trade Fears

Dow Falls For Third Day, Loses 4.4% in Week on Jobs Report, Trade Fears

Rates Are 'About Right,' Says Federal Reserve's Bullard

Rates Are 'About Right,' Says Federal Reserve's Bullard