TORONTO -- Two of Canada's biggest banks reported second-quarter earnings Thursday that benefited from bigger profit margins on the back of rising interest rates, which could be less of a boon in coming quarters as pressure mounts to raise the interest rates banks pay on deposits.

Toronto-Dominion Bank and Royal Bank of Canada handily beat analysts expectations with double-digit growth in the quarter ended Apr. 30, helped by a strong economy and growing net interest margins -- or the profit made on loans -- as interest rates rose on both sides of the border.

Of the two banks, TD reported Thursday a bigger quarterly bump, with its net income attributable to common shareholders of $2.85 billion for the quarter, up 17 per cent from a year earlier, while RBC reported a nine per cent increase to $2.98 billion.

On an adjusted basis, TD and RBC earned $1.62 and $2.10 per diluted share for the period, respectively, beating analyst expectations of $1.50 and $2.05, according to Thomson Reuters Eikon.

Both TD and RBC saw increases in net interest margins, the difference between the money they earn on loans they make and interest they pay out to savers, in both their Canadian and U.S. businesses, said Shannon Stemm, an analyst with Edward Jones in St. Louis.

The Bank of Canada has raised its trend-setting interest rate once this year and is expected to do so at least once more before the end of 2018.

A rising rate environment is helpful for the banks at the beginning of a cycle, but lenders won't be able to get away with not passing on those benefits to depositors as rates continue to climb, she said. It's a dynamic that is already underway in the U.S., but not quite yet north of the border, she added.

"After a given amount of time, as rates are going up, they have to start increasing deposit rates too," Stemm said in an interview. "And so, that squeezes that margin that was falling to the bottom line."

Year-over-year increases in net interest margins (NIM) for both banks' Canadian divisions helped fuel their big profit beats. TD's Canadian retail division's NIM was 2.91 per cent, up from 2.81 from a year ago, while RBC's Canadian personal and commercial banking division had a NIM of 2.79 per cent, up from 2.67 per cent a year earlier.

"One of the benefits has been that deposit rates have not risen as quickly as loan rates," John Mackerey, vice-president, global financial institutions group at DBRS in New York.

"So that's certainly helped with the margin expansion."

In turn, both banks saw strong earnings at home as mortgage growth remained steady despite a cooling housing market in the wake of tighter regulations for uninsured mortgages introduced at the beginning of the year.

TD's Canadian retail division net income was $1.83 billion, up 17 per cent compared with last year. RBC's Canadian personal and small business banking division reported a seven per cent increase in net income to $1.46 billion.

TD had $269 billion in its Canadian real estate secured lending portfolio at the end of the latest quarter, up five per cent from $256 billion a year earlier. RBC, meanwhile, had $258 billion in uninsured and insured residential mortgages across Canada at the end of the quarter, up 5.1 per cent from a year earlier.