TORONTO -- Oil prices rallied to a five-month high Wednesday, pushing the Canadian dollar to its best finish since July as investors were encouraged by the latest data on U.S. crude oil inventories.

The loonie edged closer to the 80-cent US mark, adding 0.06 of a U.S. cent to close at 79.05 cents US. The last time it ended the day higher was on July 3, 2015, when it hit 79.62 cents US.

The June contract for North American benchmark crude climbed $1.71 to US$44.18 a barrel, a level not seen in five months after the U.S. Energy Information Administration reported that crude inventories rose slightly less than expected last week.

The agency says commercial crude inventories increased by 2.1 million barrels last week, less than what analysts had been expected.

Signs that the global oil glut may be lessening helped support oil prices even as oil workers in Kuwait returned to the job after a three-day strike to protest cuts to pay and benefits. The work stoppage had temporarily suspended production in that country.

Michael Greenberg, a portfolio manager at Franklin Templeton Investments, said oil markets will remain volatile until the price of crude stabilize, adding that crude needs to be around US$50 a barrel to make it profitable for many producers.

Meanwhile, North American stock markets also racked up gains, with the S&P/TSX composite index adding 44.01 points to 13,911.29, helped by energy, metals and consumer staples stocks.

The Dow Jones industrial average gained 42.67 points to 18,096.27, while the broader S&P 500 was barely changed, up 1.6 points at 2,102.40 and the Nasdaq added 7.8 points to 4,948.13.

This positive sentiment pulsing through equity markets is a sigh of relief from the doom-and-gloom at the start of the year, Greenberg said.

"It's a continuation of the fact that the world didn't end," he said.

"That was kind of the narrative at the start of the year, with talk about China imploding, talk of a U.S. recession, that the Fed will hike rates four times a year and it's going to be a mistake and the U.S. dollar was strong, putting pressure on emerging markets. A lot of that has unwound a bit, at least for now. We're seeing markets catch up now."

Investors will turn their attention Thursday to the latest policy meeting of the European Central Bank even though few expect the bank to announce further stimulus measures for the 19-country eurozone.

Elsewhere in commodities, June natural gas was unchanged at US$2.18 per mmBtu, while May copper added a penny to US$2.24 a pound. June gold was flat, up 10 cents to US$1,254.40 a troy ounce.