In a trade born out of necessity, the Pittsburgh Pirates acquired Aramis Ramirez from the Milwaukee Brewers on Thursday in exchange for Minor League right-hander Yhonathan Barrios and cash.

Ramirez has $5.74 million remaining on his $14 million contract, which expires at the end of this season. Ramirez has said he plans to retire. The Pirates will take on just $3 million of what is owed to the corner infielder.

A 37-year-old firmly on the downside of his career arc doesn't seem like a logical fit for a playoff contender, but the Pirates and Brewers proved to be a perfect match. Pittsburgh was in dire need of infield help following injuries to both Josh Harrison and Jordy Mercer. Ramirez is expected to be the club's everyday third baseman until Harrison returns from left thumb surgery. If he plays well, Ramirez might then become a part-time option at both first and third.

Adding Ramirez will give Clint Hurdle flexibly across the diamond as long as health doesn't continue to be a problem. With Harrison and Mercer sidelined, the Pirates have been forced to use a patchwork lineup that has included Pedro Florimon and Brent Morel this week. Ramirez may not be the hitter he was in his prime, but he can be a consistent presence at third base as the Pirates battle to remain within striking distance of the St. Louis Cardinals in the National League Central and keep a firm gasp on one of the two Wild Cards.

It wasn't all that long ago that Ramirez was an MVP candidate. He hit .300/.360/.540 with 50 doubles, 27 home runs and 105 RBIs in his first season with the Brewers (2012). He was also a slightly above average starter last season, posting a 2.1 oWAR to go along with a .285/.330/.427 slash line.

Truth be told, Ramirez will be a very capable replacement for Harrison, who was the team's primary third baseman. A breakout star last season, the 28-year-old has struggled in 2015. All Ramirez has to do is match (or surpass) Harrison's .279/.313/.384 slash line. After struggling mightily early on, Ramirez has hit .270/.327/.477 in 245 appearances (from April 25 on).

Grade for Pirates: B

Neal Huntington filled a need by adding Ramirez, plugging a hole at third base while also giving Hurdle roster flexibility and another capable hitter. The cost wasn't too expensive. It will boil down to $3 million and Barrios, which isn't bad when you look at the market for corner infielders. The concern is that Ramirez will regress to the level of production we saw in early April.

Grade for Brewers: A-

Trading Ramirez made perfect sense for the Brewers, who were never really in contention. They save a few million dollars and add a low-risk, high-reward prospect in Barrios. The 23-year-old began his career as an infielder before becoming a pitcher full-time two years ago. He throws hard and has a 2.68 ERA in 40.1 innings across Double-A and Triple-A this season.