Police said it appears the gunman opened fire moments after Lopez pulled over the man's vehicle during a traffic stop at Federal Boulevard and Clyde Place, ABC 7 reports.
"[The gunman] almost immediately after the stop, came out of his car, based on what witnesses are saying, firing at the officer," Denver Police Commander Ron Saunier said at a Wednesday news conference.
Saunier said indications that the officer was ambushed are "based on the fact" that moments after the officer radioed that he was making the traffic stop "almost immediately the officer (was) already calling out that he was shot."
Lopez was hit in the torso and legs. He was wearing body armor at the time of the shooting, which stopped the torso shot. The leg wounds caused great loss of blood, but he is expected to survive.
Investigators believe that Lopez returned fire, hitting the gunman in the leg.