Police say the detective, 40-year old Joseph Walker, had been involved in a dispute with the driver of another car, 36-year old Joseph Harvey, Jr.
The two vehicles pulled off onto the shoulder of Interstate 97 in Anne Arundel County.
According to police, Harvey and a passenger in his car approached Walker's minivan. Walker then exited his vehicle and announced that he was a police officer.
Harvey continued to approach in an aggressive manner, police say.
Walker allegedly brandished a gun and shot in the direction of the two men, hitting Harvey.
Harvey was transported to Baltimore Washington Medical Center, where he was pronounced dead.
Harvey, of Eastampton, New Jersey, is in police custody at Baltimore Washington Medical Center.