Terry was waiting with three other agents when a gun battle with bandits errupted, officials said.
Four suspects have been taken into custody, a fifth is still on the loose.
The bandits are known to roam border areas, often robbing and sexually assaulting illegal immigrants as they cross into the U.S.
It is unclear what prompted the gunfight.
Terry, a former Marine and Michigan police officer, was part of an elite squad similar to a police SWAT team that was sent to the remote areas north of Nogales known for border banditry, drug smuggling and violence.
The Associated Press contributed to this report.