Since taking the helm in July, Chief Executive Officer Marvin Ellison has replaced nearly the entire merchandising team to get more in-demand products on shelves as the company tries to close the gap with larger rival Home Depot Inc.

While the new team helped Lowe's record better quarterly same-store sales growth than Home Depot for the first time in three years, it was not fast enough in reacting to cost increases, crimping margins, which fell nearly 3%.

"Because of ... the transition of our merchandising team, we literally had no visibility to those cost increases until the inventory that was increased in cost hit the P&L," Ellison said on a post-earnings call with analysts.

The CEO said Lowe's was looking to raise retail prices to help offset higher costs.

"We are doubling our efforts, making sure we limit the number of surprises that will get us in the future," he said.

Excluding one-time items, the company earned $1.22 per share in the three months ended May 3, missing analysts' average estimate of $1.33, according to IBES data from Refinitiv.

Overall, net sales rose 2.1% to $17.74 billion, beating expectations of $17.66 billion.

Even with strong sales, Lowe's results showed just how challenging it is to take market share in the home improvement space, Gordon Haskett analyst Chuck Grom said.

Lowe's now expects 2019 earnings of $5.54 to $5.74 per share, down from its prior forecast of $6 to $6.10 per share.

(Reporting by Uday Sampath in Bengaluru; Editing by Sriraj Kalluvila and Anil D'Silva)