After balking at how much Best Buy paid its executives a couple of years ago, shareholders are showing increasing confidence in the retailer’s executive compensation plan.

At Best Buy’s annual meeting earlier this week, 98 percent of shareholders endorsed the retailer’s executive compensation in the nonbinding “say-on-pay” vote, according to results that the company filed with the Securities and Exchange Commission.

That is a big improvement from 2012, when only 38 percent gave Best Buy a thumbs up on that measure. That vote came during a period of upheaval for Best Buy, between the resignation of CEO Brian Dunn and the ­hiring of Hubert Joly to run the Richfield-based electronics retailer.

Shareholders were particularly upset at that time by a separation package valued at more than $4 million given to Dunn, who resigned amid allegations that he used company resources to carry on an affair with a female employee. Questions also were raised about stock and retention bonuses given to top executives that were not linked to performance standards.

After that low say-on-pay vote, the company made changes such as narrowing its noncompete clauses to one year and saying executives would lose cash and stock options if they quit under pressure or were fired.

Last year, shareholders approved the say-on-pay vote by 83 percent.

In recent years, the company also has been more active in reaching out to shareholders to discuss its compensation practices and has been more closely tying pay to performance. For example, last year, the company increased the performance share of Joly’s long-term bonus from a third to a half.

This year, proxy advisers Institutional Shareholder Services and Glass, Lewis & Co. both recommended a “yes” vote on Best Buy’s executive compensation.

ISS noted that the company has improved its disclosure of metrics used for short-term bonuses and that Joly’s total compensation declined 38 percent last year, bringing his pay to just above the median of the company’s peer group.

While Glass, Lewis sanctioned the compensation overall, it still noted some concerns such as that long-term bonuses are linked to just one performance metric and that Best Buy uses companies in its peer group that are more than twice the size of its market capitalization, which can inflate pay.

Three other proposals presented to shareholders at Best Buy’s annual meeting on Tuesday also passed by wide margins. Seven directors were easily re-elected, garnering more than 95 percent of votes.

Shareholders also ratified the selection of Deloitte & Touche to be Best Buy’s public accounting firm and approved a stock and incentive plan for employees.