The suspected gunman, Radee Prince, 37, was apprehended by US agents and others, the Harford County Sheriff's Office said on Twitter, without providing further details. Prince was also being sought for a shooting in Delaware that took place after the Maryland shooting.
Prince entered Advanced Granite Solutions in Edgewood, Maryland, just before 9 a.m. and fired multiple shots from a handgun, Harford County Sheriff Jeffrey Gahler told reporters.
Three people died at the company's premises in a business park northeast of Baltimore. Two people were taken to a hospital, one of whom had come out of surgery, he said.
Those killed were identified as Jose Romero, 34; Enis Mrvoljak; and Bayarsaikhan Tudev, the Harford County Sheriff's Office said in a statement. Two other people shot in the attack were in critical condition at the University of Maryland Shock Trauma Center, it said.
Gahler called the shooting a "targeted attack." Asked about the gunman's possible motive, he said: "We believe he's tied into a relationship here at work."
Prince had worked for Advanced Granite Solutions for the past four months and had been scheduled to work on Wednesday, the sheriff said. The suspect fled in a black GMC Acadia with Delaware license plates.
Police in Wilmington, Delaware, about 30 miles (50 km) northeast of Edgewood, said Prince was also being sought for a shooting there at 10:46 a.m. that injured a man.
Wilmington police spokeswoman Stephanie Castellani said the victim identified the shooter as Prince, who fled in the same vehicle. Prince had been arrested 42 times in Delaware and had 15 felony convictions, she said."He is a dangerous individual," said Castellani, adding that the motive was not yet known but that Prince was associated with all six victims. "We do not know if there is a beef going on between the victims and the suspect."