BALTIMORE — Chris Davis and Alexi Casilla homered in a five-run seventh inning, and the Baltimore Orioles beat the Cleveland Indians 6-3 Tuesday night to end a four-game losing streak.

Davis tied the game at 3 with his major league-leading 28th home run, a two-run shot, and Casilla added a three-run drive. Both homers were off Justin Masterson (9-6), who took a three-hitter into the seventh.

Chris Tillman (9-2) gave up three runs, four hits and four walks in seven innings to win his fifth straight start. The right-hander is 6-0 in seven starts since May 19.

Jim Johnson pitched the ninth for his 27th save.

Jason Kipnis homered, walked twice and singled for the Indians, who were seeking a fourth straight road victory for the first time since April 2012.

Masterson, who was perfect through four innings, ended up allowing six runs and six hits in 6 1-3 innings.

The Baltimore seventh began with Masterson hitting Adam Jones with a pitch and Davis sending the right-hander's next offering into the bleachers. After Matt Wieters drew a walk and Chris Dickerson reached on a check-swing grounder, Casilla— the No.9 hitter in the lineup — cleared the bases.

It was Casilla's first home run since August 8, 2012 — also off Masterson. That was enough to end a four-game skid in which Baltimore lost three games to Toronto and another to Cleveland by a combined 29-15 score.

Cleveland used a single, two walks and a sacrifice fly by Michael Brantley to go up 1-0 in the first inning.

In the second, the Indians put runners at the corners with no outs but could not score. After allowing six of the first 12 Cleveland batters to reach base, Tillman retired the next six in a row.

The streak ended in the fifth inning, when Michael Bourn led off with a double and Kipnis hit a 3-1 pitch into the left-field seats.

Baltimore got a run back in the bottom half. Jones singled, took third on a single by Davis and scored on a grounder by J.J. Hardy.

NOTES: Cleveland dropped to 11-2 on the road when leading after six innings. ... Jason Hammel, who's 0-3 with a 6.20 ERA lifetime against the Indians, takes the mound for the Orioles on Wednesday night. Scott Kazmir will pitch for the Indians. ... The Orioles signed their top two draft picks, RHP Hunter Harvey and OF Josh Hart. ... Cleveland's Mike Aviles snapped an 0-for-17 skid with a first-inning single. ... Masterson and Tillman both yielded home runs for the first time since June 9.