Canadian Imperial Bank of Commerce (CIBC) and Toronto-Dominion Bank (TD) both grew their first-quarter profits as tight expense control helped them weather a storm of economic challenges including oilpatch woes, turbulent stock markets and a sluggish economy.

“The hard work we did last year to manage our cost base has equipped us better to respond to volatile markets and rising competition from non-traditional players,” TD (TSX:TD) chief executive Bharat Masrani said during a conference call Thursday to discuss the bank’s results.

TD reported net income of $2.22 billion, up roughly 8% from a year ago when it had $2.06 billion in quarterly profits.

CIBC (TSX:CM) saw its quarterly profit climb 6%to $982 million from $923 million in the same period a year earlier.

Both banks also boosted their quarterly dividends. TD’s will rise by four cents to 55 cents per share, while CIBC’s will go up by three cents to $1.18 per share.

“We achieved very strong results this quarter during a period of greater market uncertainty and volatility — conditions that may persist for the near to medium term, particularly as weak energy prices continue to be a drag on economic growth both in our own country here in Canada and globally,” CIBC chief executive Victor Dodig told analysts and investors Thursday.

“But whatever market conditions we encounter, the collective focus of our CIBC team members will remain on the following: to sustain and build on our current financial strength, to simplify and transform the way banking is done for our clients, and to deliver innovative and sustainable growth for our shareholders.”

Scotiabank analyst Sumit Malhotra said TD and CIBC’s results were better than those announced by the Bank of Montreal (TSX:BMO) on Tuesday and Royal Bank (TSX:RY), which on Wednesday reported a significant uptick in bad loans to the oilpatch.

“Yesterday Royal really spooked the market in terms of the large rise in energy impairments and provisions,” Malhotra said.

“I think for these two banks today there is a bit of a sigh of relief that you didn’t see anything particularly worrisome in the energy or the Canadian consumer metrics on the credit side. But that doesn’t mean they’re not going to have issues as we go through the course of this year.”

In addition to credit trends that looked relatively benign compared to RBC’s situation, Malhotra said CIBC and TD’s ability to keep a firm grip on their expenses allowed them to grow their earnings in spite of all the economic headwinds.

“In the environment we’re in, expense control for all of these companies is a bigger part of the equation than it would be in a more robust operating environment,” Malhotra said.

“You’re seeing some of the fruits of the restructuring efforts start to make their way into the operating performance of the banks.”

Both banks have taken restructuring charges in recent quarters as they worked to improve efficiency through a variety of measures, including revamping certain processes, closing branches and trimming their head counts.

In the first quarter, CIBC had 43,609 full-time staff — 592 fewer than it had during the previous quarter.

TD, meanwhile, had 79,927 full-time employees in the first quarter, down 627 from the prior quarter. Compared to a year ago, the bank has slimmed down its ranks by 2,256 workers.

Both banks increased their quarterly dividends.

TD says its quarterly dividend will rise by four cents, or 8% cent, to 55 cents per share — payable on April 30.

CIBC is raising its quarterly dividend by three cents per share to $1.18 per share.