FORTUNE -- When Howard Schultz returned as CEO of Starbucks in January of 2008, he hadn't realized how bad things had gotten. With the company opening an eye-popping seven new stores a day at its peak, Starbucks' business model had spiraled out of control.
"We had embraced growth as a reason for being instead of a strategy," he said during a visit to Fortune's offices last week, as he outlined Starbucks' path over the last two years.
Schultz, who was and still is the company's chairman, dropped his involvement with all other boards and outside distractions. From then on everything for him would be about only two things: Starbucks and his family. "The Brooklyn kid in me wants to make sure we prove everyone wrong," he says. (Note that while Starbucks might be from Seattle, Schultz is a born and bred New Yorker.)
He started the Starbucks (SBUX, Fortune 500) turnaround with what for many companies is the hardest thing to do: confessing its sins. Schultz had to tell his employees that the company had made mistakes and would pay the price by taking $600 million in costs out of the business. Part of that would come from laying off employees and shutting down 600 stores. 80% of them had been open for less than two years.
Even amid the cost-cutting Schultz refused to drop health care for his employees, a line item that tallies $300 million. That's more than the company spends on coffee. A shareholder called Schultz and said the crisis would provide him the perfect cover to cut benefits for part-time employees. He refused, and told his investor if he felt so strongly about it he should sell his stock. (The shareholder ended up cutting his position.)
Much to the dismay of Wall Street, Schultz decided to stop reporting monthly same-store sales in an attempt to move the pressure from producing good numbers to producing good coffee. "Monthly comps are like a harness around your neck," he says.
As the company cleaned up its internal mess, competition from serious industry players started to loom for the first time. McDonald's (MCD, Fortune 500) had rolled out its McCafe line and launched a marketing campaign that partly took aim at Starbucks. Dunkin' Donuts also was expanding, and independent coffee stores had turned into threats.
Starbucks' premium image also started to backfire. "Starbucks became the posterchild for excess," Schultz says. Consumers who had once embraced the brand's cachet now started to view the $4 latte as frivolous and a not very smart purchase.
Today Starbucks has managed to avert crisis and is diving into new areas of growth beyond simply opening new stores. Schultz says its VIA instant coffee line, which many saw as a move of desperation, will have 37,000 points of distribution by the end of the month. The company sees a hungry market in China and India, and in the U.S. the company is pushing out its newly rebranded Seattle's Best line.
Expect some of its stores to undergo a facelift with its recently renovated location on Spring Street in New York City as the model: community table, locally sourced and environmentally friendly materials, and a look that evokes its original location at Pike Place in Seattle. The Spring Street store uses a brewing system called Clover, which uses vacuum press technology.
Right now less than 20% of sales come from outside its stores, but Schultz plans to change that as he brings Starbucks more into the consumer products company realm. Because the company doesn't have any franchises, it can sell its products in supermarkets without having to worry about cannibalization from its stores.
Despite the one-time backlash against its premium image, Schultz says Starbucks has become a haven for people facing tough times. Job applications have never been higher. Employee turnover has dropped. The unemployed who have nowhere else to go spend their days in the company's stores. And perhaps its smartest marketing move of all: These customers can stay all day, and Starbucks won't ever ask them to leave.