It seems that only recently, Target (TGT -0.71%) was a retailer that everyone loved to hate. There was good reason for this, as Target was hit with a highly publicized data breach that eroded the company's brand and its image with consumers.

And if that weren't bad enough, Target then suffered through a highly costly, drawn-out expansion campaign in Canada that eventually failed. These factors did significant damage to Target's earnings, causing the stock price to fall from $73 per share in July 2013 to $55 per share by May 2014.

But now, all of that looks like a distant memory. Target has overcome its various challenges and mounted an impressive turnaround. The stock is now at a five-year high, and the company recently showered its investors with billions in a new stock buyback authorization, as well as a strong dividend increase.

Here's how Target engineered its turnaround.

Target is on the comeback trail
For most of the last two years, Target couldn't get anything right. The company revealed in late 2013 that as many as 70 million shoppers had their personal information stolen during the holiday shopping season that year. Hackers obtained data including payment card numbers, names, mailing addresses, phone numbers, and email addresses.

Soon after the data breach, Target assured investors that it would continue to work tirelessly to win back the confidence of its guests and deliver irresistible merchandise and offers.

Its first strategy was to invest aggressively in growing its digital capabilities through new initiatives. Target began offering a lower $25 threshold for free shipping, which led to increased conversion. This also helped drive in-store pick-up, which surged 100% in the first quarter. Clearly, Target's strategies worked, as digital channel sales surged 30% last year and nearly 40% in the first quarter of 2015.

Next, Target focused on building out its REDcard program, a membership that gives customers a 5% discount on their purchases, free shipping on certain orders, and an expanded return policy. REDcard penetration reached 21.5% last quarter, which was about 110 basis points ahead of the same period in 2014.

Separately, Target's turnaround has been fueled by its decision to end its money-losing Canadian venture. Earlier this year, Target announced that it would close all 133 of its Canadian stores.

Initially, expanding into Canada seemed like a good idea. Target's fierce competitor Wal-Mart Stores established Walmart Canada in 1994 and had grown to operating 391 retail units there, which suggested a precedent for success in Canada.

Target Canada brought in shoppers because of the significant promotional activity associated with the stores' grand openings. But this deep discounting resulted in big losses. Target Canada racked up $1.3 billion in sales in its last three full quarters of operation, which was 90% growth from the same period the year before. But Target Canada lost $627 million in the same period before interest and taxes.

Once the promotional activity ended, shoppers in Canada didn't return to the stores. This was clear from poor same-store sales numbers, which measured sales from stores that had been open for at least one year. In its final three quarters, Target Canada's same-store sales declined 3.3% year over year.

Equally concerning is that profitability wasn't likely to come any time soon. Target management estimated that its Canadian business would not have been profitable until 2021. Shedding these unprofitable stores has been a big boost to Target's bottom line.

Overall, Target's comeback is clear. Its comparable-store sales grew 1.3% in 2014 and then accelerated to 2.3% in the first quarter of 2015. Target's adjusted earnings per share grew 14% in the fourth quarter and 19% in the first quarter, year over year. This is what allowed Target to announce a major increase to its capital return program.

Showering investors with cash
Target recently stated that it will add $5 billion to its share buyback program, effectively doubling its share repurchase plan. Target is only $3.7 billion through its current $5 billion buyback authorization, so these buybacks will significantly help to grow EPS going forward.

In addition, Target increased its dividend by 7.7%, amounting to the 41st consecutive year of rising dividends for the company. Target has now come through with 192 consecutive quarterly dividends since the company went public in 1967.

Target has a remarkable track record of consistently rewarding shareholders with steady dividends. The stock yields 2.8%, and now that the company has returned to growth and doubled its buyback program, Target should be on investors' shopping lists.