Best Buy Co. Inc. posted one of its best quarters in years Tuesday, its surprising sales and profit growth rates impressing Wall Street and propelling its stock up nearly 13 percent.

Three years ago this month, Hubert Joly became its chief executive and took on a mega-turnaround project at the embattled consumer electronics giant. Joly slashed costs, including lots of jobs, and laid the groundwork to grow revenue, efforts increasingly coming to ­fruition.

“I think the cost-cutting effects are well documented, but this is really the breakthrough quarter for them on the top line,” said R.J. Hottovy, a stock analyst at Morningstar.

For its fiscal second quarter, Best Buy recorded a 2.7 percent jump in sales at comparable stores and a 17 percent jump in online comparable sales. Analysts were expecting flat same-store sales trends.

Buoyed by strong sales — particularly of appliances, big TVs and mobile phones — Best Buy’s profit rose 11.6 percent. Its per-share earnings of 49 cents blew through analysts’ estimates of 34 cents. And its stock closed up $3.68 at $32.96.

In an interview, Joly said, “This is not just a one-quarter phenomenon. This is really the result of changes we’ve been making over the last three years.”

Joly was upbeat about the company’s prospects during the current quarter and heading into the holidays, despite jitters about the global economy and the stock market.

“Turbulence in the financial markets — that happens, and we have seen no measurable impact,” Joly said.

During the three months that ended Aug. 1, Best Buy earned $164 million, up from $146 million in the same period a year ago.

Revenue rose 1 percent to $8.53 billion from $8.46 billion a year ago, marking the third time in the last four quarters that overall revenue has gone up. For several years, Best Buy experienced marginal declines in revenue.

Joly left his job as CEO of the Carlson Cos. in August 2012 to take the helm at Best Buy. It was hurt by a leadership controversy and was losing ground in the growing Internet marketplace for electronics. “Some people thought we weren’t going to make it,” Joly said.

Since then, the company has gotten its prices in line with competitors. Its retooled its online operations and improved delivery times for Web-ordered products. “Part of the success is attracting more buyers to the website,” said Efraim Levy, a stock analyst at S&P Capital IQ.

Best Buy has also invested more in its outlets, including through “store-within-a-store” partnerships with Samsung, Sony and Apple. It now has three mini-shop concepts with Samsung alone, one each for TVs, mobile products and appliances.

Best Buy’s strong second quarter “goes to show the strength of its partnership with its vendors,” said Morningstar’s Hottovy.

During the second quarter, Best Buy’s U.S. revenue grew nearly 4 percent, marking the fourth consecutive quarter of sales growth in its main ­operating unit.

“This is the strongest growth rate in our domestic business in at least five years,” Joly said. “For a retailer of any kind, 3.9 percent is pretty good growth, especially combined with expanding margins.”

Best Buy’s two strongest categories during the quarter were consumer electronics and appliances, sales of which were up 7 percent and 21 percent respectively, David Magee, a stock analyst at SunTrust Robinson Humphrey, wrote in a note Tuesday. “In our opinion, [Best Buy] is making significant market-share inroads,” he said.

This month, Best Buy became the first mass-market retailer to sell the new Apple Watch, aside from Apple itself. The gadget is being sold online and was initially rolled out in 100 stores. By Sept. 4, the Apple Watch will be available in more than 900 Best Buy outlets, Joly said, and in all of the company’s nearly 1,100 outlets by the end of that month.

“We are very excited by the early momentum of the Apple Watch,” he told analysts in a conference call.

 

Evan Ramstad contributed to this report.