The Cleveland Indians have traded veteran right-hander Justin Masterson to the St. Louis Cardinals.

In return, Cleveland will acquire minor league outfielder James Ramsey from the Cards.

Masterson, a free agent after this season, is 4-6 with a 5.51 ERA this year for Cleveland. He's struggled with a knee injury and was placed on the 15-day disabled list July 8 after allowing five runs and six hits in two-plus innings against the New York Yankees. He's yet to be activated.

Prior to the DL stint, Masterson hadn't won since June 8.

The 29-year-old right-hander made the All-Star team last season when he went 14-10 with three shutouts. The Indians considered him to be their staff ace going into this season, naming him their Opening Day starter.

"I was surprised,'' Masterson said. "It's bittersweet. I'm sad to leave the fellas and the fight we're making here in Cleveland, but I'm excited to get to St. Louis and be a part of what they have going there.''

Masterson and his agent, Randy Rowley, discussed a contract extension with the Indians in spring training, but negotiations broke off with no resolution in late March. Masterson had reportedly been seeking a two- or three-year deal for about $17 million a year.