Online auctioneer eBay Inc. said Tuesday it will block the sale and shipment of stun guns and other illegal weapons to New York residents under an agreement with Attorney General Eliot Spitzer.

In an investigation that started last year, Spitzer’s office found the eBay users were easily able to buy stun guns through the company’s Web site. Investigators, posing as ordinary customers, bought 16 stun guns from 16 different sellers on eBay.