Home Depot (HD -0.47%) reported fiscal 2022 second-quarter financial results on Tuesday, Aug. 16. Impressively, the home improvement retailer reported its highest quarterly sales and earnings in the company's history. 

Sales soared for Home Depot at the pandemic's onset when it was deemed an essential retailer and allowed to stay open. That coincided with consumers staying home more often and looking to improve their homes.

Surprisingly, Home Depot has sustained its elevated performance for the last couple of years despite the economic reopening and changing consumer behavior. Let's see why.

Highest earnings per share in history

In its most recent quarter, which ended on July 31, Home Depot reported sales of $43.8 billion. That was 6.5% higher than the $41.1 billion it earned in the same quarter last year. People's homes have arguably never been as important to them as they have been since the outbreak of COVID-19. Even though business restrictions have eased, many choose to work from home.

And if you're spending more time at home, you want the place to accommodate your needs, so you update the office, add a garden, and paint a few rooms. That all led to record sales for Home Depot.

HD EPS Diluted (Quarterly) Chart

HD EPS Diluted (Quarterly) data by YCharts

More importantly, Home Depot reported earnings per share of $5.05 in the quarter ended in July -- an 11.5% increase from last year. The coronavirus pandemic has disrupted supply chains worldwide. Combined with resilient consumer demand, it has given rise to widespread inflation for materials and labor costs. Home Depot demonstrated its merchandising prowess in Q2, delivering record earnings amid the inflationary pressures.

In the conference call that followed the earnings announcement, Home Depot CEO Ted Decker said:

Despite near-term uncertainties, we believe that the long-term underpinnings of demand for home improvement remain strong and that we are well-positioned to leverage our distinct competitive advantages to capitalize on compelling growth opportunities in our space.

Since Home Depot's sales surged at the pandemic's onset, investors have been waiting for the boom to reverse. While growth has decelerated, the more substantial pullback the market was expecting has not materialized. 

Home Depot's stock is inexpensive

HD PE Ratio Chart

HD PE Ratio data by YCharts.

That pessimism is partly attributable to why Home Depot's stock is down 22% off its highs from last year. Meanwhile, it has sustained earnings growth. The combination of a falling stock price and rising earnings has presented investors with an opportunity to buy Home Depot's stock at a price-to-earnings ratio of 19.9, near the lower end of its range in the last decade.

That could mean the market has already priced in an earnings slowdown for Home Depot. In other words, it has lowered the near-term risk of buying Home Depot stock. A company delivering excellent performance amid a challenging backdrop selling at a bargain price? No wonder the investing community is buzzing about Home Depot stock