In exchange for Lee, the last-place Orioles received minor league first baseman Aaron Baker. The deal was announced about 16 hours before Sunday's non-waiver trade deadline.
As a smooth-fielding first baseman with a capable right-handed bat, Lee fills a pair of holes for the Pirates (54-51), who are looking to snap a record streak of 18 consecutive losing seasons.
"I've kind of known it's been coming the last couple days, so it's not a shock or anything. It's just the business of baseball," Lee said in the Baltimore clubhouse minutes before the deal was announced.
Buoyed by their first shot at the postseason in years, the small-budget Pirates find themselves in an unusual and perhaps unexpected position at this year's trade deadline, looking to add pieces instead of sell them off.
"They are playing good. They turned it around, so good for them. I'm still playing baseball, so that's always a good thing," Lee said. "It would be exciting if we won the World Series."
A two-time All-Star, the 35-year-old Lee has playoff experience with Florida, the Chicago Cubs and Atlanta. He won a World Series ring with the Marlins in 2003.
Lee's most productive days appear to be behind him, but he's been coming on of late after a slow start in Baltimore. He is batting .246 with 12 homers and 41 RBIs this season.
Lee has hit safely in 14 of his last 18 games since July 8, batting .309 during that stretch. He had two homers and seven RBIs on Baltimore's current road trip.
Lyle Overbay was supposed to provide steady play at first base for the Pirates this season, but he's hitting only .227 with seven homers and 35 RBIs.
"We are pleased to add a quality veteran player like Derrek Lee to our ballclub," Pirates general manager Neal Huntington said in a statement. "He is an experienced, productive right-handed hitter and solid defender who should add to our team on the field and in the clubhouse."
Lee signed a $7.25 million, one-year contract with the Orioles before the season. In 15 major league seasons he has a .281 batting average, 324 homers, 1,060 RBIs and three Gold Gloves.
"I knew coming into the year there was a pretty good chance I wasn't going to finish it here. So, I understood all of it," Lee said.
Following a 17-3 loss to the New York Yankees that finished a doubleheader sweep, several Orioles teammates came over to Lee at his locker to ask about the trade and say goodbye with a hug or handshake.
"I enjoyed these guys," Lee said. "Ballpark is beautiful. We didn't play as well as we wanted to, I didn't play as well as I wanted to. But I enjoyed my time."
Baltimore said the 23-year-old Baker will be assigned to Class-A Frederick. He was hitting .285 with 15 homers, 21 doubles and 72 RBIs with Class-A Bradenton this season.
Baker was selected by Pittsburgh in the 11th round of the 2009 draft. He is a .263 career hitter in 289 minor league games.