Maguire was chasing two suspects on foot when the gunfire began. Maguire and 57-year-old Dominic Cinelli, whom police identified as the man who fired the fatal shot, were both struck.
Maguire was taken to Lahey Clinic in Burlington, where he was pronounced dead. Cinelli of Woburn was pronounced dead at the scene.
A visibly shaken Woburn police Chief Philip Mahoney told reporters that Maguire was planning to work one more year before retiring and was moving from the night shift to the day shift in anticipation.
"We do not have shootings in Woburn. It's not that type of community, and last night Officer Maguire lost his life defending it right in the middle of Washington Street," he said. "It was almost like the Wild West between the two of them."
Investigators said the 60-year-old Maguire was shot four times. He is survived by his wife and two children, ages 21 and 22.
Heavily armed police officers and state troopers used dogs to search nearby stores and retail complexes for other suspects, eventually arresting 19-year-old Scott Hanwright and 51-year-old Kevin Dingwell, both of nearby Wakefield.
Hanwright was charged Monday with first-degree murder and ordered held without bail. Dingwell, who police say was the getaway driver, was charged with being an accessory after the fact and ordered held on $1,000 bail.
Both pleaded not guilty during their arraignment. The Middlesex district attorney's office didn't have information on their lawyers.
Mahoney, who has been on the force for 41 years, said it's the first time he can recall that that an officer has died in the line of duty in the city.
Woburn Mayor Scott Galvin remembered Maguire as a hardworking police officer who was proud to be carrying on a family tradition. His father once served as police chief.
Woburn, a city of about 40,000 residents, is about 10 miles north of Boston.
Menomonee Falls, Wis.-based Kohl's is offering counseling to employees who were working at the time of the robbery.
"This was a tragedy for all involved and our deepest sympathy goes out to the officer's family," Kohl's spokeswoman Vicki Shamion said in a statement, deferring further questions to Massachusetts authorities.