Officer Darian Jarrott initiated the February traffic stop on Omar Felix Cueva, who police say was on his way to Las Cruces for a drug deal.
Police said Cueva had a "violent criminal history," including drug charges involving cocaine and meth.
When Officer Jarrott, who was speaking to Cueva through the passenger window, asked him to step out of the vehicle, Cueva got out of the pickup truck with an AR-15-style rifle and fired a shot at Jarrott.
WARNING: THIS VIDEO CONTAINS GRAPHIC CONTENT AND LANGUAGE THAT SOME MAY FIND DISTURBING
Jarrott fell to the ground, at which point Cueva fired several more shots at him, including one at point-blank range to the back of the head.
Less than a minute after Cueva fled the scene, a Homeland Security Investigations agent arrived on the scene and notified dispatch that Jarrott was down.
A 40-mile chase ensued as officers from New Mexico State Police, the Cruces Police Department, the Dona Ana County Sheriff’s Office, and U.S. Border Patrol pursued Cueva, exchanging gunfire along the way.
Law enforcement eventually stopped Cueva by blowing out his tires with tire deflation devices.
Before Cueva's pickup truck even came to a stop, bystander video shows him exit his vehicle with a pistol and open fire on officers, who returned fire and killed Cueva.
Las Cruces police officer Adrian De La Garza was also struck by gunfire, but was airlifted to a trauma hospital in Texas where he was treated for non-life-threatening injuries.
Officer Darian Jarrott, who had three small children and was expecting a fourth one this year, was sworn in as a New Mexico State Police officer in July 2015. He worked as a Transportation Inspector for the New Mexico Department of Public Safety before that.
"Even when there was a situation that was tough, the guy was always smiling," New Mexico State Police Chief Robert Thornton said in February.
The Associated Press contributed to this report.