Canada's main stock index eked out a gain Thursday as base metals helped offset weakness in energy, while U.S. markets rose.

The S&P/TSX Composite Index closed up 4.30 points at 20,278.51.

In New York, the Dow Jones Industrial Average was up 62.95 points at 36,117.38. The S&P 500 Index was up 36.25 points at 4,585.59, while the Nasdaq Composite was up 193.28 points at 14,339.99.

The Canadian dollar traded for 73.55 cents U.S. compared with 73.67 cents U.S. on Wednesday.

The January crude oil contract was down four cents at US$69.34 per barrel and the January natural gas contract was up two cents at US$2.59 per mm/BTU.

The February gold contract was down US$1.50 at US$2,046.40 an ounce and the March copper contract was up six cents at US$3.80 a pound.