State Street Corp. has agreed to pay $5 million to resolve a federal investigation into whether it discriminated against female and black executives by paying them less than their colleagues.

The settlement comes only months after the financial giant received plaudits for sponsoring the “Fearless Girl” statue near Wall Street in Manhattan as part of its effort to get more women placed on the boards of public companies.

In March, an office within the Department of Labor found that State Street had discriminated against women at the senior vice president, managing director, and vice president levels by paying them less than men in similar positions. The agency also claims the company paid black employees less than similarly positioned white employees.

The pay practices covered a two-year period and affected 305 female executives and 15 black vice presidents, the government said. They will receive a total of $4.5 million in back pay and nearly $508,000 in interest.

On Thursday, State Street disputed the federal agency’s findings, but spokeswoman Julie Kane said the company decided to settle the case to bring “this six-year-old matter” to a resolution.

Kane said the company “is committed to equal pay practices and evaluates on an ongoing basis our internal processes to be sure our compensation, hiring, and promotions programs are nondiscriminatory.”

Kane said the agency’s analysis focused on pay data from only 2010 and 2011 and involved just the workforce at the company’s One Lincoln St. headquarters.

The company employs about 36,000 people worldwide, including 11,600 in Massachusetts.

State Street also pledged to conduct its own compensation analysis for upper-level executives at its headquarters tower and agreed to provide those results, as well as payroll data the agency can use to conduct its own evaluations. The company agreed to conduct these studies annually for three years.

The federal agency had claimed that State Street violated federal regulations by failing to perform an in-depth analysis to determine impediments to equal employment opportunities. State Street denied that accusation, but agreed to perform these in-depth analyses, including by analyzing all factors that result in gender- and race-based compensation disparities.