Axel Galvez had a deal: $7,500 for five untraceable semiautomatic rifles. And he had a buyer: a felon who planned to ship them overseas. Now, he just needed weapons that would be invisible to regulators.

To avoid background checks, Mr. Galvez bought rifle parts, then assembled the five guns at the Los Angeles machine shop where he worked. He offered to build his buyer 100 more for $130,000.

An underground gun-making industry that enables criminals to elude background checks and bypass gun regulations is creating a growing trade of “ghost guns,” weapons that can’t be traced by police, authorities say.

Mr. Galvez’s buyer turned out to be a government informant; the 36-year-old machinist pleaded guilty in November to unlawful firearms manufacturing and dealing, according to court documents.

Ghost guns have been in the spotlight since a Northern California man, who was prohibited from possessing firearms because of a restraining order, killed five people in a November rampage using semiautomatic rifles that he made himself, police say. Other gunmen have employed the weapons as well. In 2016, a Baltimore man fired at police with a homemade AR-15, and Santa Monica shooter John Zawahri used a ghost gun in his shooting spree that killed five in 2013.