Home Depot Inc. (HD) hit the nail on the head and then some with its second-quarter top- and bottom-line beats.

Shares rose more than 2% to $198.85 in premarket trading after the home-improvement giant raised full-year sales guidance. Yet they closed down slightly at 193.10 on Tuesday.

Home Depot reported second-quarter sales of $30.5 billion, up 8.4% from a year earlier, and higher than Wall Street's expectations of $30 billion on Tuesday, Aug. 14. Overall comparable-store sales increased 8% and U.S. comp sales came jumped 8.1%. Wall Street expected overall same-store sales to rise 6.7%. Earnings per share were $3.05, up from $2.25 a share a year earlier. Wall Street expected $2.85.

In a note published on Tuesday, Goldman Sachs' Matthew Fassler wrote: "We expect the stock to have an inline reaction to the print, as expectations were elevated, in our view, and the company is,  as expected,  guiding to notable second half [of year] deceleration against tougher storm-driven compares. The read-through for LOW [Lowe's Companies Inc.] suggests a print inline with our forecast."

The bank gave Home Depot a neutral rating and price target of $194. Fassler wrote that the rating and price target were under review until after Tuesday's call that starts at 9 a.m. ET. "Upside risks include faster housing recovery and cost control," he added. "Downside risks include softer housing and weather-related volatility."

RBC Capital Market's Scott Ciccarelli wrote in a note that low home inventory will ultimately be "bullish for the home-improvement sector" and that Home Depot will continue gaining market share and is one of the best-run U.S. retailers.

"While the company's accelerated investment spending to improve their supply chain is expected to moderate earnings growth over the next two to three years," he said, "we believe these investments will help future-proof Home Depot's business against online competition. As a result, we remain buyers of HD shares."

The company raised its fiscal 2018 sales growth guidance to up 7.0% from 6.7% and its same-store sales outlook to 5.3% from 5.0%. The EPS growth outlook was increased to 29.2% from 28.0%.

"We were very pleased with our record second-quarter sales and earnings. Not only did our seasonal business rebound from the first quarter, but our overall results exceeded our expectations," said Craig Menear, chairman, CEO and president.

The No. 1 home-improvement company also raised guidance, saying it expects fiscal 2018 sales to grow 7%, with comp sales growth of about 5.3%. Home Depot said it expects per-share earnings to rise 30% to $9.42. 

Analysts predicted strong growth in the second quarter based on the fact that many homeowners were staying put, rather than buying new homes, and were shopping at Home Depot and other home-improvement companies to buy supplies.

More from Investing

Jim Cramer: Markets Have a Way of Making Fools of Us

Jim Cramer: Markets Have a Way of Making Fools of Us

FDA Considers Banning Online e-Cigarette Sales: LIVE MARKETS BLOG

FDA Considers Banning Online e-Cigarette Sales: LIVE MARKETS BLOG

Facebook's News Feed Curator Could Be the New Head of Instagram

Facebook's News Feed Curator Could Be the New Head of Instagram

Sunoco's Quant Buy Recommendation Will Only Help the Bullish Charts

Sunoco's Quant Buy Recommendation Will Only Help the Bullish Charts

Intelsat: A Good Example of Why You Should Not Call Tops

Intelsat: A Good Example of Why You Should Not Call Tops