CLEVELAND (AP) -- Nothing comes easy for the Cleveland Indians these days.
The Indians cruised into the ninth inning with what seemed a comfortable lead Tuesday night, but had to hang on for a 4-3 victory over the Baltimore Orioles.
Ubaldo Jimenez pitched six shutout innings while Yan Gomes and Asdrubal Cabrera drove in two runs apiece, before Chris Perez finally slammed the door in the ninth after allowing the Orioles to get back in the game.
Perez, pitching in a non-save situation, got into immediate trouble. Singles by Nick Markakis and J.J. Hardy started the inning before Nate McLouth's three-run homer on a 3-2 pitch cut the lead to one.
The crowd of 9,962 - and just about everyone else in Progressive Field - got a little nervous, including Jimenez.
''I was a little worried,'' Jimenez said with a laugh. ''It was getting kind of close, but Chris got back to his old ways after they scored those three runs.''
Perez struck out Brian Roberts and Manny Machado before facing Chris Davis, who leads the majors with 47 home runs. Davis hit a ground ball to second baseman Jason Kipnis, who was playing in shallow right field, for the final out of the game.
Perez pleaded no contest and was convicted of misdemeanor drug abuse Tuesday for marijuana shipped to his home in the family dog's name, an incident that took place in June. Despite the fact Perez appeared in court earlier in the day, Indians manager Terry Francona didn't hesitate to use his closer.
''I actually thought he threw the ball pretty well,'' Francona said. ''He got the ball up to McLouth, but for the most part I thought he threw the ball pretty good.''
Jimenez (10-9) has allowed three earned runs or less in eight consecutive starts. The right-hander held Baltimore to four hits and worked out of a bases-loaded jam in the sixth.
''He goes out there and gives us six shutout innings against that lineup,'' Francona said. ''That's exciting.''
Gomes' two-run double was the key hit in Cleveland's sixth. Cabrera had sacrifices flies in the fourth and sixth.
Orioles starter Chris Tillman (15-5) allowed four runs in 5 1-3 innings. The right-hander has one win in his last six starts.
Both teams are battling for the second wild card spot in the American League. Baltimore entered Tuesday's play two games behind while Cleveland was 3 1/2 games off the pace.
The Indians, who had lost six of seven, needed some good news. Justin Masterson, the team's No. 1 starter, will miss at least one start because of a strained left oblique. The right-hander could be out the rest of the season.
''We did a lot of good things tonight,'' Francona said. ''We played a nice crisp game. That's how we have to play.''
The Indians are 14th in the AL in attendance despite the fact they're contending for a playoff spot. Monday's game drew a crowd of 15,020.
''Of course we notice,'' Jimenez said of the team's attendance. ''It's definitely not the same when we have a big crowd, but what can we do? We have to go out there and compete.''
The Orioles loaded the bases in the sixth on a single and two walks, but Jimenez retired Michael Morse on a tapper to the mound to end the inning.
Jimenez went 1-4 in August despite a 3.10 ERA while receiving a total of seven runs of support. He had dropped four of his last five starts. Jimenez, who struck out four, has recorded 32 strikeouts in 24 2-3 innings over his last four games.
''Jimenez was as good as anyone in baseball three or four years ago, and it looks like he's got his velocity back,'' Orioles manager Buck Showalter said. ''He was really crisp with his changeup and his fastball was working for him all night.''
Cabrera's sacrifice fly gave Cleveland the lead in the fourth after Kipnis and Carlos Santana walked to start the inning.
Santana led off the sixth by drawing another walk and took third on Michael Brantley's double into the left field corner. Cabrera's second sacrifice fly scored Santana and Gomes' double later scored Brantley and pinch-runner Matt Carson.
The Orioles, who are 3-5 on a nine-game trip that ends Wednesday, are 8-12 since Aug. 12.
NOTES: LHP Zach Britton, called up from Triple-A Norfolk on Monday, will start for the Orioles in Wednesday's series finale. The other five starters will be moved back one day. ... A college reunion took place before the game when Indians OF Drew Stubbs caught the ceremonial first pitch from Browns RB Chris Ogbonnaya. The two were roommates at the University of Texas. ... Indians OF Ryan Raburn (left Achilles soreness) was activated from the 15-day DL. ... The Indians recalled RHPs Carlos Carrasco, Chen-Chang Lee, Vinnie Pestano, and Josh Tomlin from Triple-A Columbus. Tomlin underwent Tommy John surgery on his right elbow in August 2012. ... The Orioles recalled 2B Jonathan Schoop, OF Henry Urrutia and RHP Josh Stinson from Norfolk, and 2B Ryan Flaherty from Single-A Frederick.