Lowe's on Wednesday reported quarterly earnings that beat analysts' expectations and raised its forecast for the year, even as revenue fell short of projections.

Shares rose more than 5%, hitting a new 52-week high, as investors took the second-straight quarter of better-than-expected results as a sign it is executing its turnaround plan under CEO Marvin Ellison, who took the helm in 2018.

In the third quarter, the company took steps to restructure its operations in Canada, update its e-commerce business and continue its focus on the professional contractor, or pro, customer.

"At first blush, this looks like the turnaround at Lowe's continues to progress," Oppenheimer analyst Brian Nagel said on CNBC's "Squawk Box."

Here's what Lowe's reported compared with what Wall Street was expecting, based on a survey of analysts by Refinitiv:

Earnings per share: $1.41, adjusted, vs. $1.35 expected

Revenue: $17.39 billion vs. $17.68 billion expected

Same-store sales growth: 2.2% vs. 3.1% expected

At its Canadian business, the company shook up its leadership and said it plans to close 34 stores in the fourth quarter. Despite the store closures, Ellison said the company is "committed" to its Canadian operations.

"While making decisions that impact our associates and their families is never easy, closing underperforming stores is a necessary step in our plan to ensure the long-term stability and growth of our Canadian business," said Tony Cioffi, interim president of Lowe's Canada.

In the third quarter ended Nov. 1, Lowe's said net income grew to $1.05 billion, or $1.36 per share, from $629 million, or 78 cents per share, a year earlier. Excluding the cost of restructuring its operations in Canada, the company earned $1.41 per share, topping estimates of $1.35 per share in the Refinitiv survey.

Sales grew $17.39 billion, just shy of analyst estimates of $17.68 billion.

Ellison told CNBC that the majority of the company's sales growth is coming from existing customers who are spending more as a result of changes the company has made at its stores.

"We had a lot of customers shopping us but they were just cherry-picking us in certain departments and not buying the whole store," Ellison said. "When we adjusted some of the service models, some of the staffing, some of the pricing, those folks started to spend more across the store."

Consolidated same-store sales, which were dragged down by weak performance in Canada, grew 2.2% in the quarter. Analysts were expecting a 3.1% gain. Sales at U.S. stores open at least 12 months rose 3%.

"We were pleased with the performance of our U.S. home improvement stores, which reflects a solid macroeconomic backdrop and continued progress in our transformation driven by investments in customer experience, improved merchandise category performance, and continued growth of our Pro business," Ellison said in the earnings release.

Lowe's now expects to earn $5.63 to $5.70 per share in fiscal 2019, on an adjusted basis, compared with a prior estimate of $5.67 per share.

When Ellison first stepped into his current position, he initially underestimated how much work the company's e-commerce business needed, he said on the company's earnings call.

Online represents about 5% of total sales and Lowes.com delivered comparable-sales growth of 3% in the third quarter.

Online sales growth is expected to accelerate in the back half of 2020, Ellison said.

He explained that the company's entire site will be moved from a decade-old platform to Google cloud by the first half of 2020 and that many other improvements to the site will be made, including improved search and navigation, the ability to schedule product delivery and one-click checkout.

Also during the quarter, Lowe's launched a pilot for its new pro loyalty program in certain test markets, said Joseph McFarland, executive vice president of stores, on the earnings call.

He said that early results of the pilot exceeded expectations and Lowe's will launch the program nationally in the first half of 2020.

The company's move to increase staffing, provide better service, and improve inventory levels and pricing structure across its stores also helped bring in more pro customers.

"We have, you know, over 1,700 stores in the U.S. and so we are very accessible to pros working on the job," Ellison said. "Now that we have fixed all those fundamental things those pros are starting to shop with us because not only are we convenient, now we can actually service their needs."

Rival Home Depot has always had a larger share of the professional space. About 45% of Home Depot's business comes from its professional customers, according to Jonathan Matuszewski, an analyst at Jefferies. By comparison, Lowe's gets about 20% to 25% of its sales from this group, he said.

McFarland said there was a noticeable increase in competitive promotions in the third quarter.

Home Depot on Tuesday reported weaker-than-expected fiscal third-quarter sales, and cut its 2019 sales forecast, because its latest investments are taking more time than expected to pay off.

The Atlanta-based company said Tuesday it is in the process of improving its B2B website, which was created mostly for the company's pro customers. The site still requires underlying technical work before the company can move forward with additional elements.

Read Lowe's full press release here.