CLEVELAND — Justin Masterson began the season as the Indians’ ace. He’ll end it with a different team in a different league.

Cleveland traded the disappointing Masterson on Wednesday to the St. Louis Cardinals, a deal that will allow the Indians to get something in return for the 29-year-old righty who was in his final year under contract.

“I was surprised,” said Masterson. who pitched parts of two seasons with the Portland Sea Dogs (’07 and ’08) and the Boston Red Sox (’08 and ’09). “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.”

In exchange for Masterson, who was scheduled to come off the disabled list later this week, the Indians got outfielder James Ramsey. A first-round pick by the Cardinals (No. 23 overall) in 2012, Ramsey has spent this season at Double-A Springfield, where he batted .300 with 13 home runs and 36 RBI.

Masterson went 14-10 last season and then turned down an offer of a contract extension in spring training.

Masterson is 4-6 with a 5.51 ERA in 19 starts this season and has had a noticeable loss in velocity. In five starts before being placed on the DL with right knee inflammation, he allowed 19 runs and 27 hits in 18 innings.

WHITE SOX: Reliever Nate Jones had surgery on his right elbow and is expected to need 12 to 15 months to recover.

Diamondbacks: Infielder Eric Chavez announced his retirement, ending his 17-year major league career at the age of 36.

The left-handed hitting infielder, on the disabled list since June 9 because of a sprained left knee, spent 13 seasons with the Oakland Athletics, two with the New York Yankees and was in his second season with Arizona.

AMERICAN LEAGUE

ASTROS 8, ATHLETICS 1: Dallas Keuchel pitched a four-hitter and Robbie Grossman homered to cap a six-run first inning that sent Houston to a win over visiting Oakland.

INDIANS 2, MARINERS 0: Corey Kluber had a three-hitter to outpitch Felix Hernandez for his first career shutout, Yan Gomes had a two-run double and Cleveland beat visiting Seattle.

ORIOLES 4, ANGELS 3: Kevin Gausman pitched seven innings of three-hit ball, Adam Jones homered and Baltimore beat visiting Los Angeles for its seventh win in nine games.

TIGERS 7, WHITE SOX 2: Max Scherzer pitched seven impressive innings, and Detroit scored six runs in the first inning in beating visiting Chicago.

Nick Castellanos hit a three-run homer in the first and added an RBI single in the seventh for the Tigers, who snapped a four-game losing streak.

RANGERS 3, YANKEES 2: Colby Lewis retired his last 13 batters in seven strong innings as Texas topped visiting New York.

New York didn’t have a runner after Carlos Beltran’s two-out single in the third.

ROYALS 3, TWINS 2: Salvador Perez triggered a go-ahead rally with a double in the sixth, helping Kansas City win at home.

INTERLEAGUE

BREWERS 5, RAYS 0: Yovani Gallardo gave up three hits in seven innings, Martin Maldonado tied a career high with four RBI and visiting Milwaukee avoided a three-game sweep by beating David Price and Tampa Bay.

Price (11-8), the subject of trade speculation, had his bid to win a team-record seventh consecutive start dashed after allowing four runs and seven hits over seven innings.

NATIONAL LEAGUE

NATIONALS 4, MARLINS 3: Tanner Roark won his fourth consecutive start and visiting Washington averted a series sweep by snapping Miami’s six-game winning streak.

DIAMONDBACKS 5, REDS 4: Paul Goldschmidt hit a two-run homer that kept Alfredo Simon winless since the All-Star game, and Arizona held on at Cincinnati.

METS 11, PHILLIES 2: Daniel Murphy hit a three-run homer to back up Zack Wheeler’s sixth straight strong start, and New York routed visiting Philadelphia.

GIANTS 7, PIRATES 5: Reliever Jean Machi and San Francisco took advantage of a huge baserunning blunder by visiting Pittsburgh, tagging out two runners who wandered away on the same play, to end a six-game losing streak.