"Felipe is an accomplished veteran player who gives us versatility at three infield positions," Brewers general manager Doug Melvin said. "He has been a very productive player at the top of the order with respect to both batting average and on-base percentage."
Lopez is expected to join the team Monday in Pittsburgh. A corresponding move will be announced to make room for him on the roster.
"Obviously, where we are in the standings, I think you have to consider trades like this," D-backs general manager Josh Byrnes said. "Felipe played really well for us and fit in well, especially with the younger players. But the reality is he's a free agent at the end of the year, and he brought back two guys that we think have long-term value to us."
Lopez, 29, signed a one-year deal with the D-backs before the start of the 2009 season.
"It's just the business side of baseball," Lopez said. "I'm leaving [Arizona] on a good note with this organization. One of the reasons I signed here was because I believe in this organization -- I still do. This team is only a couple of things away from being really good. Everybody treated me well -- coaches, players -- so I had a great experience."
Lopez did his part in Arizona. He hit .301 with six home runs, 25 RBIs and six stolen bases in 85 games with the D-backs. He has made 79 starts at second base and one at designated hitter, and remains among the National League leaders with a .372 on-base-percentage.
A career .266 hitter, Lopez has hit 77 home runs with 359 RBIs and 115 stolen bases in 958 games during nine seasons with Toronto (2001-02), Cincinnati (2003-06), Washington (2006-08), St. Louis (2008) and Arizona (2009). He was an All-Star in 2005 when he hit .291 with 23 home runs, 85 RBIs and 15 stolen bases in 148 games with the Reds. He earned the Silver Slugger Award at shortstop that season.
"It's tough leaving the guys here because I spent a lot of time with the young guys and it's tough leaving them," Lopez said. "But at the same time I'm excited for the opportunity."
Jesse Sanchez is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.