Tuesday's sell-off in shares of Walgreen (NYSE: WAG) provides a buying opportunity for investors who want in on a best-of-breed company at a discount. While Walgreen's second quarter wasn't as good as its most recent quarters, the biggest problem I saw was that analysts' expectations were a bit too high since the company had been performing so well as of late.

Profit rose 10% and sales rose close to 9% in the quarter, outpacing consensus estimates, while Walgreen also continues to gain market share in the retail prescription business, but the whisper numbers had investors looking for even better results. The company has outperformed competitors such as CVS (NYSE: CVS) and Rite Aid (NYSE: RAD) by focusing on cost-cutting throughout its stores and slowing its rapid expansion to focus on same-store-sales growth, which continues to improve.  Walgreen has used some of these cost savings to reward shareholders through share buybacks and dividends. The company bought $300 million in shares in the quarter and $500 million in the first quarter.

The company has made some savvy moves of late to separate itself from competitors. Walgreen earlier this month ridded itself of its pharmacy benefit management business, which didn't quite fit within the company's core strategy and, as CEO Greg Wasson said, created "conflicts" within the business. CVS has also struggled significantly with its PBM business integration of Caremark, and a similar move might be in order for that company as well.

I am also impressed with Walgreen's focus on tailoring specific stores to individual communities. Walgreen has been particularly strong in this regard with its highly successful acquisition of New York City drug chain Duane Reade. In a place like Williamsburg, N.Y., which is perhaps the hipster capital of the U.S., this is essential for success.  In this small community in Brooklyn, change and big corporate brands are not readily accepted, and Walgreen faced local protests to prevent the company from opening a new Duane Reade store near the local mom-and-pop drugstore.

To appease the community, Walgreen decided to differentiate itself from the longtime community drug store by adding draft beer lines in which customers could fill growlers to take home. The store also focuses on local breweries from the region, such as Sixpoint Craft Ales and Brooklyn Brewery, both of which operate just a few miles away. While hipsters may not like corporate chains, they certainly like beer.

Walgreen is still outperforming its competitors, and management continues to prove adept in following its strategy of focusing on store quality over quantity.  I believe yesterday's sell-off is a good opportunity to get in on this best-of-breed company that continues to perform.