MEXICO CITY (Reuters) -Walmart’s Mexico unit on Wednesday said its fourth-quarter net profit grew more than 5% from the year-earlier period with the gross margin helped by new business lines, even as higher expenses ate into earnings.

Walmart de Mexico, the biggest retailer in Mexico, said its net profit rose to 13.3 billion pesos ($646.3 million) from the prior October-to-December period. Revenue increased 9.5% to reach 214.6 billion pesos.

The company said in a report that same-store sales were solid across Mexico and Central America, and new businesses such as advertising platform Walmart Connect and rental income helped the gross margin, which grew 10 basis points to just over 23%.

The retailer also stressed positive performance in online shopping after an uncertain year in the aftermath of the COVID-19 pandemic.

“2021 was tough to predict in every aspect, even more so on the e-commerce front,” Chief Executive Guilherme Loureiro said in an online presentation accompanying the results report.

E-commerce net sales increased 24% in the fourth quarter and made up 1.2% of total sales growth. They now represent almost 5% of sales in Mexico compared with 1.5% in 2019, before the pandemic spurred a jump in online shopping.

The company continued its expansion in physical stores too, opening 51 sites in the quarter in its main Mexico market. The retailer opened 131 locations in the full year.

However, the company known as Walmex also reported a more than 13% jump in costs, and the EBITDA margin fell to 11% from 11.4% a year before.

“We’re seeing an increase in the cost of doing business in areas such as salaries, along with strategic investments,” Walmex said in a report.

The investments included converting 75 Superama grocery stores into the Walmart Express format, part of more than 20 billion pesos the company spent in 2021, up 22% from the year before.

However, the company spent 8% less than planned because it decided to delay some logistics projects until this year, it said.

Executives said the company would focus on productivity and managing expenses to compensate for ongoing costs, including planned investments.

Walmex executives reiterated that the company is considering what it has called “strategic alternatives” to its operations in Central America, as announced last month.

However, they said the process is still just beginning and there was still the possibility of not executing any changes at all.

($1 = 20.5075 Mexican pesos at end-December)

(Reporting by Daina Beth Solomon, Noe Torres and Valentine Hilaire; editing by Richard Pullin and Diane Craft)