The loss was the first at home this season for the Rockies after a franchise-record eight straight home wins to start the season.
Lopez was the fourth reliever used by Weiss, who had to turn to his bullpen after starter Juan Nicasio gave up two runs in 4 1/3 innings, but threw 96 pitches in the process. Adam Ottavino and Josh Outman, making his 2013 Rockies debut, combined for two scoreless innings before Matt Belisle gave up a run in the eighth on a walk and Cody Ross double.
Didi Gregorious, who homered in the fifth, opened the ninth by grounding a single up the middle. A.J. Pollock then hit a high bouncer that went over the leaping Jonathan Herrera's head at third base and landed in short left field for a double.
"I was playing like two steps in front of third base," Herrera said. "It was perfect. He was swinging, and the ball was over my head. I almost caught that ball, but nothing you can do."
Pinch-hitter Alfredo Marte hit a grounder that Herrera charged. He looked home, but thought better of trying to get Gregorius at the plate and took the out at first.
"I saw him break on contact," Herrera said. "I caught the ball like on my left side, and I was telling myself I need to make a perfect throw and throw out of my balance. It's a tough decision. You take a shot and you don't know what's going to happen. It's going to be a really close play at home plate."
Gerardo Parra followed with a sacrifice fly that scored Pollock, who took third on Marte's grounder. The win enabled the D-backs to avoid being swept in the series, following 3-1 and 4-3 losses in the first two games.
"We finally got a break," D-backs manager Kirk Gibson said. "Herrera's playing him in at third base and luckily the ball went over his head, so it was a good break for us."
The Rockies had to rely more on their bullpen than they have recently, having gotten at least six innings from their starter in each of their past three games and wins from their starters in six of the previous seven games.
But Nicasio was done in more by a mounting pitch count than damage by the D-backs' lineup. He held the D-backs hitless until Gregorius opened the fifth with his homer. Nicasio threw 24 pitches in the first, despite facing only four batters. He then threw 25 in the second when he issued two walks and began a 23-pitch third with a 13-pitch at-bat to Parra.
"I need to command my fastball, because I throw like 90-some pitches in three games," said Nicasio, who threw 97 pitches in six innings, 95 in five innings and 97 in five innings in his three previous starts.
The loss was disappointing, but one the Rockies were able to put in perspective.
"It was definitely a tough loss," said Troy Tulowitzki, who hit his sixth homer in the sixth, giving him 17 RBIs to tie his career high for RBIs in April. "I think we've got to take some positives out. We did some good things. We lost that lead late. But we got to look at we won another series and that's the most important thing."
At 13-5, the Rockies are tied for the best record in the Majors with the Braves, who come to Coors Field for a three-game series on Monday.
"It's going to be a good series," Carlos Gonzalez said. "They've been doing their job, just like we've been doing."
And like Tulowitzki, Gonzalez chose to look at the big picture, rather than dwell on the disappointing loss that ended a lengthy winning streak.
"Someday, you're going to fail and that was today," Gonzalez said. "If we're going to do it, it was better to do it that way. It was a good game. We played really hard. We been doing that from Day 1 and if we continue to do that, a lot of positive things are going to happen.
"It's tough, but at the same time, we won the series. We feel good about ourselves. We've shown what kind of team this is. We're ready to play every night we play anybody who comes to our park, or when we go on the road."