Wal-Mart Stores has agreed to pay $40 million to 87,500 Massachusetts employees who claimed the retailer denied them rest and meals breaks, manipulated time cards and refused to pay overtime.

The settlement - believed to be one of the largest of its kind in the state - seeks to resolve a class-action lawsuit filed in 2001.

An affidavit filed by plaintiffs’ attorney Philip Gordon says people who worked for Wal-Mart between 1995 and this year will receive payments of between $400 and $2,500, depending upon their years of service.

The settlement needs approval from the Middlesex Superior Court.

A Wal-Mart spokeswoman said resolving cases of this kind serves the company's best interests.