Home Depot named Chief Financial Officer Richard McPhail as its next chief executive officer, replacing Ted Decker, the company said Tuesday. The change takes effect next week.

Decker has been CEO since 2022. He had been on temporary medical leave since August. The company said Decker has returned from leave but is stepping down. He will remain chair of the board of directors.

Ann-Marie Campbell, currently senior executive vice president of U.S. stores and operations, will become president and chief operating officer. Jordan Broggi was chosen to replace McPhail as CFO.

McPhail has been with the company since 2005 and has held multiple executive roles. He told CNBC's Becky Quick, "We're not going to change course." He said the company will keep focusing on professional shoppers such as contractors and will keep using AI tools to encourage sales. He also said the company faces more challenges now than at the start of the year, but is still winning share of the home improvement market.

The announcement came with Home Depot's fiscal third-quarter earnings report. The company beat analyst expectations on the top and bottom lines. Comparable sales rose 2.2%, compared with estimates of 1.8%, according to StreetAccount. Net income was $3.71 billion, or $3.72 per share, versus $3.60 billion, or $3.62 per share, a year earlier. Excluding one-time items, adjusted earnings per share were $3.86. Revenue rose 4.9% from the year-ago period. Online comparable sales grew about 13%, the sixth straight quarter of double-digit growth for that metric.

For the full year, Home Depot expects total sales to rise roughly 4.5%, the top of its previous range. It now expects comparable sales to grow about 1.4%, versus its earlier outlook of flat to 2%. It expects adjusted earnings per share to rise 2%, compared with prior guidance of flat to 4%.

The company has faced pressure from a sluggish housing market, higher mortgage rates and more cautious consumers. Home Depot has said it has seen resilience among its professional shoppers.