Best Buy raised its profit and sales expectations ahead of the holiday shopping season after a strong third quarter.

Comparable-store sales at the nation’s largest consumer electronics chain rose 2.7 percent, fueled by computing, gaming and mobile phones.

It was the biggest gain in three years for the Minnesota retailer.

Best Buy reported net income of $140 million, or 66 cents per share, for the three-month period ended Nov. 1, or $1.40 when adjusted for one-time charges and benefits.

That was 9 cents better than Wall Street had expected, according to a survey by data firm FactSet, though below last year’s $273 million, or $1.26 per share.

Sales rose to $9.67 billion from $9.45 billion, also beating expectations.

The company raised its earnings per share forecast for the current year to between $6.25 and $6.35 per share. That’s up from the previous range of between $6.15 and $6.30 per share.

It also now expects sales of $41.65 billion to $41.95 billion for the year, up from its original forecast of $41.1 billion to $41.9 billion.

Best Buy also forecasts that comparable sales will be up anywhere from 0.5 percent to 1.2 percent for the year. Its earlier forecast called for a 1 percent decline to an increase of 1 percent.

The strong quarter is seen as an encouraging sign for Best Buy, which, like most American companies, has spent months navigating an uncertain economic environment as President Donald Trump imposes wide-ranging tariffs on imports.

Electronics have been particularly impacted.

Consumer sentiment has sagged and the just ended 43-day federal government shutdown has also impacted the economy, analysts said.

Shoppers continue to spend, though there are broad signs that they have grown more cautious and often are lured only by discounts.

Inflation is still stubborn, yet the consumer impact is not as bad as originally feared because Best Buy and other retailers have absorbed some of those increases.