A container ship sits docked in a berth at the Port of Oakland.

The U.S. trade deficit widened in December as a strong dollar and weak global demand continued to weigh on exports.

The Commerce Department said on Friday the trade gap rose 2.7 percent to $43.4 billion. November's trade deficit was revised down to $42.2 billion from the previously reported $42.4 billion.

Economists polled by Reuters had forecast the trade shortfall widening to $43.0 billion in December. The dollar gained 9.2 percent against the currencies of the United States' main trading partners last year, eroding the appeal of U.S.-made goods overseas. Lackluster global demand also has put a damper on exports.

Trade subtracted almost half a percentage point from gross domestic product in the fourth quarter, helping to hold down growth to a paltry 0.7 percent annual rate. It is largely expected to remain a drag in the first quarter.