TORONTO -- North American stock markets fell midweek on escalating trade tensions over a trade deal with China and crude oil prices hitting their lowest level in nearly five months.

"The appetite for risky assets remained elusive Wednesday and investors remained on edge as U.S.-China trade tensions came back in full focus," says Candice Bangsund, portfolio manager for Fiera Capital.

Among the drivers of investor concerns were comments from U.S. President Donald Trump that he won't make a deal with China unless Beijing agrees to four or five major points. It's still unclear if negotiations will reconvene at the upcoming G20 Summit in Japan with Commerce Secretary Wilbur Ross saying that even if they do a formal accord is unlikely at this event.

The S&P/TSX composite index closed down 21.52 points to 16,227.24.

Eight of the 11 major sectors were up led by materials, technology and telecommunications.

However, the heavyweight energy and financials sectors were lower.

Energy fell 1.3 per cent as the July crude contract was down US$2.13 at US$51.14 per barrel, the lowest level since Jan. 14. The July natural gas contract was down 1.3 cents at US$2.39 per mmBTU.

Crude prices decreased on a jump in U.S. oil inventories and an uncertain demand outlook due to the tenuous trade backdrop. That sent Encana Corp. down 6.6 per cent, followed by Crescent Point Energy Corp.

The Department of Energy said U.S. inventories rose to their highest level since mid-2017 on the back of record production. Domestic crude stockpiles increased last week by 2.2 million barrels. Analysts had forecast a decrease of 481,000 barrels.

Financials fell led by a 2.4 per cent drop by Power Financial Corp. as softer-than-expected U.S. inflation numbers reinforced calls for the Federal Reserve to cut interest rates, which spilled over to Canadian bond markets.

The Canadian dollar was trading at an average of 75.17 cents US compared with an average of 75.37 cents US on Tuesday.

Materials was higher as the August gold contract was up US$5.60 at US$1,336.80 an ounce and the July copper contract was down 1.75 cents at US$2.65 a pound. Barrick Gold Corp. rose 3.2 per cent, followed by Yamana Gold Inc.

"Gold advanced as nervous investors flocked to the safety of bullion as the showdown between the U.S. and China lingered on, while increased speculation for Federal Reserve rate cuts also boosted gold prices," Bangsund wrote in an email.

Technology climbed as Blackberry Ltd. rose 6.2 per cent while Roots Corp. gained 7.1 per cent on first-quarter results.

In New York, the Dow Jones industrial average was down 43.68 points at 26,004.83. The S&P 500 index was down 5.88 points at 2,879.84, while the Nasdaq composite was down 29.85 points at 7,792.72.