The Toronto stock market closed little changed Thursday amid a mixed bag of earnings reports from the resource sector and higher commodity prices.

The S&P/TSX composite index dipped 3.16 points to 12,669.14 after earnings released from Teck Resources (TSX:TCK.B) and Husky Energy (TSX:HSE) beat expectations. But global fertilizer producer PotashCorp (TSX:POT) weighed on the exchange as it missed expectations and lowered its 2013 profit forecast.

The Canadian dollar rose 0.49 of a cent to 97.43 cents US.

U.S. indexes turned higher amid earnings from General Motors and Facebook that also beat expectations and the Dow Jones industrials edged up 13.37 points to 15,555.61.

The Nasdaq gained 25.59 points to 3,605.19 and the S&P 500 index was up 4.31 points to 1,690.25.

Teck (TSX:TCK.B) reported a second-quarter adjusted profit of $197 million or 34 cents a share, down sharply from $398 million of profit a year ago but three cents above estimates. One of Canada’s largest coal producers and a major miner of copper, zinc and other commodities, Teck said it’s increasing cost-reduction efforts to deal with lower prices for its products. Its shares advanced 72 cents to $24.41.

“Obviously, they can beat expectations that have been lowered,” said Allan Small, senior adviser at DWM Securities, who owns Teck shares. “(But) it’s going to be a little while yet before we see Teck doing well.”

He pointed out that “many in the investment world are not expecting much out of the base metal miners”, in large measure because of slowing growth in China and falling demand.

But he also noted that a rising U.S. dollar is also depressing prices and “as the currency gets more expensive, you tend to buy less.”

A stronger greenback makes it more expensive for holders of other currencies to buy oil and metals, which are denominated in U.S. dollars.

Husky Energy (TSX:HSE) gained 57 cents to $30.15 as it said quarterly profit rose 40 per cent from a year ago to $605 million or 59 cents a share. Earnings ex-items were 62 cents, five cents better than estimates.

Meanwhile, Goldcorp Inc. (TSX:G) reported a US$1.93-billion net loss in the second quarter, as it was hit by a massive writedown of its Penasquito mine in Mexico due to the falling price of gold and its impact on the project’s exploration potential.

The Vancouver-based mining company says it would have been profitable in the second quarter without the writedown, but its adjusted earnings were still down from last year and missed analyst estimates. Its shares lost 39 cents to $28.85.

Shares in PotashCorp (TSX:POT) fell 82 cents to $38.35 after it cut its profit estimate for the current year and reported a quarterly profit of $643 million, or 73 cents per diluted share, up from $522 million, or 60 cents per share a year ago. The results missed estimates for a profit of 79 cents per share.

In the U.S., General Motors says second-quarter net income fell 16 per to $1.26 billion or 75 cents a share cent as slowing international profits and losses in Europe offset strong North American earnings. Still, GM soundly beat Wall Street expectations. Excluding one-time items, it made 84 cents per share. Analysts polled by FactSet expected 75 cents.

Revenue was up four per cent to just over $39 billion, beating Wall Street’s estimate of $37.7 billion and GM shares lost early momentum and headed down six cents to $37.08.

Facebook shares rocketed up 29.6 per cent to US$34.35 after the social network company said that it earned $333 million, or 13 cents per share, in the April-June period, up from a loss of $157 million, or eight cents per share, a year ago. Adjusted earnings were $488 million, or 19 cents per share, above the 14 cents that analysts were expecting. Facebook’s revenue grew 53 per cent to $1.81 billion, well above the $1.62 million that analysts were expecting.

Mobile revenue was $655.6 million, or 41 per cent of the quarter’s total advertising revenue of $1.6 billion.

Commodities turned higher with the September crude contract on the New York Mercantile Exchange up 10 cents to US$105.49 a barrel. Crude shook off early losses in the wake of a report that showed U.S. durable goods orders for June surged 4.2 per cent, after running up 3.7 per cent in May.

The energy sector was up slightly. Precision Drilling (TSX:PD) ran up 47 cents to $10.39 as the company posted a quarterly profit of only $473,000 profit, worth less than a penny per share. That was down from a profit of $18 million or six cents per share a year earlier as the company felt the impact of softer conditions in the oil and gas industry. However, analysts had expected a one cent a share loss and revenue also came in better than expected.

The Teck results helped push the base metals sector up 0.27 per cent while September copper was unchanged at US$3.18 a pound. Elsewhere in the sector, HudBay Minerals (TSX:HBM) fell 23 cents to $7.02.

The gold sector was ahead 0.5 per cent with August bullion $9.30 higher to US$1,328.80 an ounce. Iamgold (TSX:IMG) gained 13 cents to C$5.45.

In other corporate news, BlackBerry (TSX:BB) is laying off 250 workers at its new product testing facility in Waterloo, Ont. Its shares slipped four cents to $9.26.