By Byron Kaye and Nikhil Nainan

(Reuters) -Commonwealth Bank of Australia posted a forecast-beating surge in first-half profit and said it would buy back $1.4 billion of stock as a home loan boom offset thinner margins. Its shares soared 6%.

The country’s biggest lender outpaced rivals in attracting home buyers, benefiting from its sheer volume of business at a time when ultra-low interest rates and a switch by many borrowers to fixed-rate mortgages are squeezing loan margins.

CBA’s loan margin narrowed more than rivals, dropping 14 basis points from the same period a year earlier. But cash profit – the measure banks focus on because it only includes ongoing business – jumped 23% to A$4.75 billion ($3.4 billion).

That compares with an average estimate of A$4.35 billion from four brokerages. A decline in provisions for impaired loans contributed to the profit increase.

“The margin compression was worse than what I was expecting, but…the settings are in place for the bank to do really well when the rates do go higher,” said Nathan Zaia, an analyst at Morningstar.

“They’ve demonstrated they can take share and keep processing more and more loans.”

The Australian property market has been on a tear since the introduction of emergency-level interest rates at the start of the pandemic. Nationwide house prices rocketed 22% higher in 2021, with many buyers keen to upsize amid a shift to working from home.

CBA said the margin pressure was likely to continue as more borrowers changed to fixed-rate loans although expected interest rate rises from August 2022 are likely to provide a strong tailwind for profit margins.

The bank sees “strong underlying momentum” in Australia “at least until the end of 2023,” CEO Matt Comyn told an analysts call, citing hefty savings, wage growth and rising demand for goods.

Also bolstered by the A$2 billion share buyback and an interim dividend hike worth A$3 billion, CBA’s shares logged their biggest intraday jump in nearly two years, valuing the lender at A$170 billion.

Westpac and Australia and New Zealand Banking Group have also reported margin pressure. National Australia Bank, the last of the country’s four main banks, is expected to follow suit on Thursday.

($1 = 1.3963 Australian dollars)

(Reporting by Byron Kaye in Sydney and Nikhil Kurian Nainan in Bengaluru; Editing by Edwina Gibbs)