Home Depot shares climbed more than 4.5% Tuesday after the retailer released a mixed earnings report that didn't appear to haunt investors.

Home Depot's fiscal second-quarter sales missed analysts' expectations, and the company lowered its sales outlook for the year amid fears that the trade war will slow consumer spending. But its earnings topped estimates, and analysts say that positions Home Depot well for the back half of 2019.

"We continue to view Home Depot as a best-in-class operator, but the softer macro and housing trends ... remain an overhang," Telsey Advisory Group analyst Joseph Feldman said in a research note.

Wells Fargo analyst Zachary Fadem said he viewed the mixed results as "a clearing event for an improving setup ahead." Investors like to see that cost savings are paying off and helping boost profitability, he said.

Home Depot CEO Craig Menear said the company trimmed its 2019 outlook due to "continued lumber price deflation, as well as potential impacts to the U.S. consumer arising from recently announced tariffs."

"While trade discussions are fluid, consumer demand could be impacted," Edward Decker, executive vice president of merchandising, told analysts on a conference call.

The company has estimated that the currently proposed 10% tariffs, set to take effect Sept. 1 and Dec. 15 — along with the 25% tariffs already in place — could raise its cost of sales by about $2 billion, or about 2% of annual sales. Analysts say Wall Street largely already knew this impact to Home Depot's business, thus why shares aren't selling off on the news.

Here's what Home Depot reported for the fiscal second quarter of 2019 compared with what analysts were expecting, based on Refinitiv data:

Earnings per share, adjusted: $3.17 vs. $3.08 expected

Revenue: $30.84 billion vs. $30.99 billion expected

Same-store sales: up 3% vs. growth of 3.5% expected

Net income for the quarter ended Aug. 4 was $3.48 billion, or $3.17 per share, compared with $3.51 billion, or $3.05 a share, a year ago. That beat expectations for earnings of $3.08 a share, based on Refinitiv data.

Sales climbed 1.2% to $30.84 billion from $30.46 billion a year ago, short of expectations for $30.99 billion.

Sales at Home Depot stores open for at least 12 months were up 3% overall and were up 3.1% in the U.S., short of expectations for growth of 3.5%.

The Atlanta-based company had also previously warned about the toll a slump in lumber prices is taking on its business.

Lumber futures are down roughly 16% since their highs in February, and lumber accounts for about 8% of Home Depot's total sales. Home Depot said in May that weak lumber prices hurt first-quarter sales growth by about $200 million. It added that if prices didn't improve, it could dent annual sales by as much as an additional $600 million.

On the heels of Tuesday's mixed results, Home Depot is now calling for fiscal 2019 sales to be up about 2.3%, and same-store sales to be up about 4%. Previously, it was calling for total sales growth of 3.3% and same-store sales growth of 5%.

It's still expecting earnings per share to grow by about 3.1% to $10.03 for the year.

Home Depot said the average shopper's ticket grew 1.7% during the second quarter to $67.31 from $66.20 a year earlier. It said sales per square foot climbed 1.1% to $509.55 from $504.20 in fiscal 2018.

"We are encouraged by the momentum we are seeing from our strategic investments and believe that the current health of the U.S. consumer and a stable housing environment continue to support our business," Menear added.

Home Depot shares, which are valued at $238.9 billion, closed Tuesday up 4.4%. The stock has climbed more than 26% this year.