Jaime Zapata, 32, was killed and another agent, identified as Victor Avila, was wounded while traveling from Mexico City to San Luis Potosi on Tuesday.
The ICE agents stopped their SUV at a checkpoint on an isolated highway, but it was a setup. Officials say it's a tactic often used by drug traffickers.
Authorities believe the gunmen knew they were attacking law enforcement officers, but they don't think the two men were targeted. It's possible the suspects were just trying to steal their SUV.
"When they were stopped, they thought they were being stopped by the military. They flashed their U.S. agent credentials at what they thought was the military," said Paul Magallanes, a Mexico security expert.
One border security expert says this was a brazen attack, happening on a well-traveled highway.
Investigators believe the checkpoint was staffed by members of a notorious drug cartel known to control much of northern Mexico.
Zapata's murder is the latest in what appears to be targeted attacks on federal agents. Last year, Border Patrol agent Brian Terry was shot and killed in a gun battle in the Arizona desert. Another Border Patrol agent Robert Rosas was killed in Mexico, just south of San Diego.
American civilians have also been attacked. One of the most publicized incidents was the murder of David Hartley last year. The 30-year-old and his wife were jet skiing on Falcon Lake on the U.S.-Mexico border when they were ambushed by gunmen in boats.
And just last month, Nancy Davis, an American missionary, was shot to death while driving with her husband near the border town of Reynosa.
Some see Zapata's murder as a game changer, the kind of case that forces the U.S. to intervene in the ongoing violence in Mexico.
Almost 35,000 people have been killed in Mexico ever since Mexican President Felipe Calderon started cracking down on cartels more than four years ago.