No matter how much your family got on your nerves last Thanksgiving, Best Buy executives probably had a more stressful holiday than you did.

By the time Turkey Day 2014 arrived, the company had spent two years pursuing a sweeping, difficult turnaround strategy, and with the kickoff of the holiday shopping season, when Best Buy BBY typically earns a third of its annual revenue, the stakes were stratospherically high.

To ramp up for Black Friday, the electronics retailer’s stores opened at 5 p.m. on Thanksgiving, the earliest they had ever begun their doorbuster deals. Forgoing cranberry sauce and stuffing, some 40 execs made a foray out from their Richfield, Minn., headquarters to visit local stores (their own and the competition’s)—and were greeted with the subzero temperatures of one of the Twin Cities’ coldest Thanksgivings on record. Chats with chilly customers couldn’t answer their burning question: Will this season be a boom or a bust? And around 4 a.m. Friday morning, CEO Hubert Joly was jolted out of bed by a frantic call from Mary Lou Kelley, his relatively new head of e-commerce, telling him that the company’s website had gone down during an unexpected traffic surge.

By the time the executives reconvened Black Friday evening, few had slept or eaten more than a slice of pizza. But as data rolled in from across the country, the mood perceptibly lifted. Like campaign workers watching election results, the team was getting good news, state by state—stores had been full, sales numbers were on track. The crowd was too cautious to celebrate, recalling disappointments of Christmases past. “You have to remember that nothing is over until the fat lady sings,” Joly says. But by the time Best Buy reported results for the holiday period, their hopes had been realized: Comparable-store sales rose for the first time in four years—up 2.5%, even as the consumer-electronics industry overall reported declines. And fourth-quarter profits jumped 77% year over year.

The performance was particularly validating for chief financial officer Sharon McCollam, a revered veteran of Williams-Sonoma whom the 56-year-old Joly calls his co-pilot. Joly, a former McKinsey partner who became CEO in the summer of 2012, had lured McCollam out of retirement that December. Since then she had implemented a rigorous budget; overhauled Best Buy’s IT, supply chain, and logistics; and even inspected stores with a “white glove” dust test. By the time the holidays were over, she was confident that she had engineered an enduring revival. “This one thing will probably go down in my personal history book as one of the most meaningful things that I ever got to do,” McCollam says.

08^739145 3shop112814.jpg CEO Hubert Joly greeted customers at a store in Roseville, Minn., on Thanksgiving in 2014. Strong Black Friday sales last year were a sign of the retailer’s recovery.Photograph by Jeff Wheeler—Star Tribune

This Black Friday, Best Buy will have something to build on. On the eve of its 50th anniversary, Best Buy—bogged down three years ago in mounting losses and management disarray—seems to be back on track. The largest consumer-electronics retailer in the world (No. 72 on the Fortune 500) and the only surviving U.S. nationwide chain, Best Buy has redesigned most of its 1,433 U.S. stores, put its retail employees through retraining boot camp, become a force in e-commerce, and excised $1 billion in annual costs. Earnings have beaten Wall Street’s expectations for 11 quarters in a row; since December 2012 its stock has roughly tripled. “Best Buy is one of the most impressive turnarounds in retail over the last decade,” says Scott Galloway, marketing professor at NYU Stern and founder of brand-research firm L2. “Three years ago the conventional wisdom was they were a carcass that had just been run over by Amazon.”

Today Best Buy executives are optimistic enough that they agreed to talk about their transformation for the first time, with Fortune. Still, they’re keenly aware that the turnaround is far from finished—and that bogey, Amazon AMZN , gets bigger every day. Best Buy is far smaller than it was in its heyday, having sold off underperforming divisions in China and Europe. It’s expecting just under $40 billion in revenue for the current fiscal year, down from $51 billion four years earlier. Its market cap, at $12 billion, is less than half of what it was at its 2006 peak. Best Buy is the leader in a plateauing industry, a conundrum that could eventually box in the big-box retailer’s growth. Growing revenue again is “not an easy task in a mature category,” says Stephen Baker, vice president and consumer technology analyst at market researcher NPD. “What the consumers want and buy is changing, and if you’re not flexible to move with that, you’re going to end up with Circuit City and CompUSA”—that is, out of business.

Samsung Experience Shop Opening With Samsung Mobile CEO JK Shin And Best Buy CEO Hubert Joly Best Buy CEO Hubert Joly celebrates the opening of the Samsung Experience Shop at Best Buy Union Square on April 24, 2013 in New York City. Photograph by Neilson Barnard — Getty Images for Samsung

To avoid that fate, Best Buy is betting on a contrarian theory: As the Internet of things is built into everything from thermostats to wristwatches, Best Buy’s brick-and-mortar emporium—and its army of roving IT guys, the Geek Squad—will be in demand to help people catch up with the increasingly complicated gadgets. Already its sales of connected-home devices are accelerating, and its tech experts make some 4 million house calls a year to help customers rig up their systems—service that Best Buy’s closest competitors, Walmart WMT and Amazon, do not offer. As “the greatest toy store for adults the world has ever seen, Best Buy has a special responsibility and opportunity” in this realm, says Robert Stephens, the Geek Squad’s founder, who last served as Best Buy’s chief technology officer before leaving in 2012.

In a wrinkle that defies gadget-geek stereotypes, Best Buy’s leadership team is largely female: Women run operations accounting for 90% of its revenue. Inspired by a McKinsey colleague’s gender-diversity research—on which Sheryl Sandberg’s Lean In is partly based—Joly has fully committed to it at Best Buy. A mirthful Frenchman known for his lilting delivery of quotations of everyone from Winston Churchill to Batman, Joly sums up his rationale: “If it had been Lehman Sisters instead of Lehman Brothers, maybe it would not have been the catastrophe that it was.”

Best Buy wasn’t quite Lehman when Joly arrived, but it was certainly in crisis. Unlike such rivals as CompUSA, Circuit City, and RadioShack (all of which went bankrupt), Best Buy had kept revenue growing through the Great Recession, opening more stores and scooping up customers as its peers collapsed. But by 2012, with locations in every state and Puerto Rico, Best Buy was running out of room to expand, and it was losing market share under the onslaught of discounts from websites like

Just as sales and profits began deteriorating, a scandal roiled the company. In April 2012, CEO Brian Dunn quit amid allegations that he’d had what a board investigation deemed an “inappropriate relationship” with a female employee. The board also discovered that Best Buy’s founder and chairman, Richard Schulze, had known about the affair for months; he resigned upon the release of the board’s report. (Dunn never commented on the relationship claims; Schulze stated at the time that he accepted the committee’s findings.) Best Buy appeared to have passed a point of no return; shares plunged to a 12-year low. “They were just a rudderless ship,” says BB&T Capital Markets analyst Anthony Chukumba.

Things got worse when Schulze, who founded the company in 1966 as a St. Paul record store called Sound of Music, resurfaced after his resignation with an unsolicited bid to take Best Buy private. Schulze was hardly appeased in September 2012, when Best Buy’s board hired Joly—an executive from hospitality company Carlson with zero retail experience. At his first board meeting, Joly assessed the bleak state of the company: “This is the most dysfunctional organization I’ve ever seen,” he recalls saying. “But this is good news because this is self-inflicted, and so this is something we can correct.”

Joly hustled to do just that. Donning a signature Best Buy blue polo shirt, the new CEO spent his first week on the floor of a local store, gleaning insights and formulating a plan. He also did some power-networking: Early on, he went to Cupertino, Calif., to visit Tim Cook, CEO of Apple AAPL , one of Best Buy’s biggest vendors. (Best Buy was the first outside retailer in the U.S. to carry the Apple Watch, and it now sells more iPads than Apple itself does, according to analytics firm Consumer Intelligence Research Partners.) As Joly recalls, Cook “was kind enough to say, ‘Years ago, in the media, it was always “the beleaguered Apple.” You’re now “the beleaguered Best Buy,” but there will be a good time after that.’ ”

Best Buy Second Quarter Profit Drops 91 Percent People walk by a Best Buy store in New York City.Photograph by Spencer Platt — Getty Images

In October, Joly paid a visit to Schulze, résumé in hand, to ask for his blessing. Schulze wasn’t initially moved. But over the next few months, as he watched his successor unveil “Renew Blue,” Joly’s turnaround plan, it “was a confidence builder for me,” he tells Fortune. By March 2013, Schulze had abandoned the takeover, and he soon returned to the company as chairman emeritus.

Joly found his right-hand woman in McCollam. A 5-foot-tall Midwesterner whose voice is soft but imbued with urgency, McCollam had turned around a losing vegetable department at Dole Food and executed a post-recession comeback at Williams-Sonoma WSM . The day she announced she was leaving the latter company, its stock fell 6%. Her most recent Best Buy experience hadn’t been good. In 2010 she’d placed an online order for a pink point-and-shoot camera for her niece, only to get a message that it would not arrive by Christmas—then spent 45 minutes on hold trying to cancel the order. (Her response: “I became an Amazon Prime member.”)

Before McCollam accepted the roles of CFO and chief administrative officer, she toured 75 stores to diagnose the severity of the problems. She saw disrepair everywhere, from product displays to store restrooms—signs that the company had let maintenance lapse as it ran low on cash. The website was also broken; Best Buy didn’t even show up on page 1 of search results when you Googled “video games.” She sensed the company was in danger. “I would love to not be the cost-reduction queen,” says McCollam with a sigh, but when the alternative was letting Best Buy and its employees’ livelihoods disappear, it “forces you to be that way.”

McCollam and Joly started cutting at headquarters. The private jets were the first to go, along with trips to the World Economic Forum in Davos. They’ve nixed NASCAR sponsorships and Super Bowl ads. They also targeted the small stuff. McCollam’s approach was, “I don’t need you to go find the million-dollar idea—I’d love for you to go find the $10,000 idea,” says Corie Barry, chief strategic growth officer. Nowadays, there’s nary a color printer at Best Buy’s offices. The big-box retailer also literally made its boxes smaller, cutting back on expensive packaging that was dwarfing its devices.

Making a sprawling workforce more efficient was the next challenge. When McCollam walked into her first staff meeting, she recalls, she found herself in a half-empty room; it turned out many of her direct reports were working from home. On any given day, 20% to 35% of corporate employees would be absent. Best Buy ended its no-questions-asked remote-work policy in early 2013, just weeks before Yahoo YHOO made waves with a similar ban. Inbox clutter was another target. Managers were getting hundreds of emails a month with reminders to, say, boost credit card sign-ups or thwart shoplifters, depending on the suits’ frustrations of the day. The instructions confused retail employees, who thought each new priority was “more important than actually growing revenue,” says U.S. retail president Shari Ballard, a 23-year company veteran who now oversees all domestic stores.

The new leaders sliced out some of the extra cooks in the corporate kitchen, eliminating several layers of management; in all, some 2,000 people were laid off. (The overall staff currently numbers about 125,000, down from a peak of 180,000.) Employees now focus on the metric Ballard prizes most: revenue per hour.

Joly has empowered employees at all levels to act quickly and even unilaterally. “The difference between great leaders and good leaders is not the quality of their decisions. It’s the quantity of their decisions,” he says. One of Joly’s biggest—and earliest—decisions came in 2012, when he committed Best Buy to matching Amazon’s prices (as well as those of other major competitors). “This was a hard thing to do, because you have no idea what the financial implication of that is,” McCollam says. “And you know you can never go back.” The change has paid off, analysts say, helping Best Buy regain market share in several categories.


But to truly compete with its dotcom nemesis, Best Buy had to deliver products faster. In years past, items on would often appear as “sold out” because they weren’t stocked in the closest e-commerce warehouse; even in-stock items often took a week or more to reach customers.
In spring 2013, McCollam upended that dynamic by instructing 50 Best Buy retail locations to start shipping products to fulfill e-commerce orders. By early 2014 all of Best Buy’s stores were also distribution centers—and delivery times improved drastically. This year, Best Buy has delivered 67% of its packages in two days or less, and averages shipping speeds faster than Amazon’s standard (non-Prime) orders, according to retail analytics firm StellaService. Making in-store items available online unlocked an additional $2 billion in inventory for potential sales, says McCollam. The tech team, under Mary Lou Kelley, has also made more crash-resistant, upgrading the site to a cloud-based infrastructure.

From Joly’s point of view, shake-ups like these saved Best Buy; what’s more, he says, with women in leadership roles, Best Buy’s staff was more motivated to join in. “Men tend to be like horses. They see the goal, and they march,” says Joly. “Women tend to care more about the group … be more sensitive to the mood. Because you may arrive to the goal, but if everyone is, like, dead in the water, that’s not a great outcome.”

Just before 10 p.m. on a Friday night, Best Buy’s only round-the-clock location, on 14th Street in Manhattan, looks like a consumer-technology museum crossed with an arcade. The Internet-of-things presence is visible everywhere: One aisle, for example, features Nest’s familiar trio of connected thermostat, smoke detector, and security camera, along with wireless “smart” lighting systems. There’s also an exact replica of an Apple Store, with iPhones displayed on low wooden tables, and at an Intel INTC exhibit a customer tries out a motion-sensing videogame that turns his own hands into joysticks.

In the new Best Buy, electronics manufacturers are increasingly staking out store territory for themselves. The “shop-in-shop” concept took off in 2013, after Samsung Electronics co-CEO JK Shin met with Joly and Best Buy chief merchant Mike Mohan on a stopover in Minneapolis. Shin was looking for ways to showcase Samsung’s sleek new Galaxy smartphones. In the kiosk concept, he and the Best Buy executives saw a chance to help each other. The day Best Buy announced the partnership, its stock price soared 16%. In shop-in-shop deals, manufacturers invest millions of dollars with Best Buy—underwriting marketing and more attractive displays, and training sales staff—but still spend less than they would to build their own stores. Some analysts worry that Best Buy’s dependence on its vendors may backfire if certain products go out of style. But so far, the partnerships have subsidized Best Buy’s overhead and shored up its status as the electronics industry’s biggest showroom.

Holiday Shoppers Seek Out Deals On Black Friday Shoppers in a Best Buy store.Photograph by Spencer Platt — Getty Images

Only in the past year have Best Buy’s same-store sales finally increased again, and management gives considerable credit to Chris Schmidt. A year ago Schmidt was Best Buy’s Colorado market director and was consistently growing sales, even as fewer customers were walking into his stores. His secret was a spreadsheet into which he had plugged employees’ scores on all performance metrics Best Buy tracked. Realizing that none of the measures mattered if his staff wasn’t closing sales, he sorted the spreadsheet to spot laggards to target for further education—perhaps they needed extra training on “smart” 4K TVs, or tips on conversation openers that wouldn’t scare off customers. “Even tiny bits of movement yield massive amounts of return,” Schmidt says of the behavioral tweaks, which could increase a single employee’s sales by tens of thousands of dollars a year.

After seeing the Denver method in action, Ballard ran with it. By last Thanksgiving, she had taught all 2,000 Best Buy store leaders a data-driven training program they call Individual Sales Tracker. (She also promoted Schmidt to vice president of sales operations.) “What’s the biggest difference, and why are the stores growing? I would say: That,” Ballard says.

Even Best Buy’s former adversaries laud its success. “They’ve done a terrific job, and they’ve had a lot to overcome,” says James Marcum, the last CEO of Circuit City. Of course, Best Buy still faces the challenge of selling inherently cyclical products whose already low-margin prices decline over time. Analyst Chukumba, a bull on Best Buy, recognizes the headwinds. “People just say, ‘Consumer electronics is a crappy business,’ ” he says, with Best Buy as “the best house on a bad block.” Even as sales rebound, Wall Street is pressing Best Buy to shutter more stores to cut real estate costs. (Management has closed only nine big-box locations since the turnaround began, saying its stores are more profitable than people realize.)

In such an environment, maintaining morale is among the biggest challenges. When Kelley woke Joly last Black Friday to tell him the website had gone down, she wondered whether the gaffe was a fireable offense. To Joly, however, Kelley was demonstrating his ideal problem-solving approach, one with which men, he says, often have a harder time: “Bad news has to travel at least as fast as good news.” To encourage this, Joly has been known to pass out his cellphone number to store staff, who stop to take pictures with him when he visits. And these days he’s cheering and prodding those team members as they prepare for the upcoming holiday season—when they’ll face pressure to raise the bar yet again. “Let me be clear: This is a terrific, amazing comeback,” Joly tells Fortune. “But it’s a game that’s never over.”

For more on tech, watch this Fortune video:

A version of this article appears in the November 1, 2015 issue of Fortune with the headline “The new geek squad (that’s fixing Best Buy).”