BALTIMORE (AP) -- The Baltimore Orioles boldly ran the bases without fear of being caught, and Kansas City couldn't do a thing about it.
A comedy of errors ensued, and the Orioles escaped with a 5-3 victory Wednesday night despite allowing two home runs and getting only five hits.
J.J. Hardy homered and Manny Machado scored a run and hit an RBI single for the Orioles, whose season-high fourth consecutive win moved them eight games over .500 (21-13) for the first time this year.
''We're playing good baseball right now,'' said Hardy, whose two-run drive in the second inning put Baltimore ahead for good.
But the game was decided in the fifth, when the Orioles went up 5-1 with a three-run uprising fueled by three Kansas City errors and a wild pitch.
After Chris Dickerson hit a leadoff double, shortstop Alcides Escobar grabbed Nate McLouth's sharp grounder and tried to get Dickerson at third, but the throw hit Dickerson to put runners at the corners.
McLouth promptly stole second, and Machado followed with a single to bring home Dickerson. Machado then stole second, and McLouth came home after Escobar couldn't handle the poor throw from catcher George Kottaras. Escobar's throw home was also off target, allowing Machado to take third, and he scored when starter Luis Mendoza uncorked a wild pitch.
''When we can pick up on errors like that, it's huge,'' Machado said. ''That brings up the momentum for us and brings it down for them. That's baseball.''
The way Royals manager Ned Yost saw it, the first bad throw laid the groundwork for the miscues that followed.
''The key to that inning was if Escy just takes the out at first, they only get one run,'' Yost said. ''He tried to make a play, tried to keep it close to him by going to third. He just threw low and hit him in the back of the spike and that got a rally going. Now you got (runners at) first and third instead of just a runner at third. Then they start taking off and everything falls apart.''
Escobar lamented both his poor throws, saying, ''I can't believe that I made stupid errors like that.''
Baltimore has been outhit in each of its past three games, including 7-5 in this one. The Orioles are 3-6 when outhit by their opponent.
''You know, at the end of the day, it's whoever scores the most runs, so we made key hits today,'' Machado said. ''We had key hits from J.J. on that home run. Myself driving in that run. . Our goal is to get on base and get deep into counts and bring in those runs when they get on.''
Chris Tillman (3-1) allowed three runs and five hits in six innings to win his third straight start. The right-hander came in 0-2 with a 10.93 ERA in three career starts against the Royals.
Troy Patton pitched the seventh, Darren O'Day and Brian Matusz worked the eighth and Jim Johnson got three outs for his 13th save.
Johnson has converted 34 straight save opportunities, tying the club record set by Randy Myers in 1997.
''It's good, obviously, but that's a secondary goal of mine,'' Johnson said. ''Obviously winning the game is always the first objective.''
Alex Gordon hit his second home run in two games and Mike Moustakas went 3 for 4 with a homer for Kansas City.
Mendoza (0-2) gave up five runs, three earned, and five hits in six innings.
Baltimore took a 2-0 lead in the second when Matt Wieters led off with a single and Hardy followed with a drive just inside the left-field foul pole. It was his sixth home run of the season, the third in four games.
Mendoza didn't allow another base runner until Hardy drew a two-out walk in the fourth.
Tillman blanked the Royals on two hits through four innings, then retired the first two batters in the fifth before Gordon homered to right. That ended Tillman's run of consecutive scoreless innings at 15, a streak that began on April 27 in Oakland.
NOTES: Orioles 2B Brian Roberts will have surgery on his right hamstring Thursday, a procedure that will keep him sidelined at least an additional six weeks. He's been on the disabled list since April 5. ... Royals RHP Jeremy Guthrie (4-0) will face his former team for the first time Thursday night in the series finale. Guthrie, who's undefeated in his past 17 starts, was traded from Baltimore to Colorado in February 2012. Freddy Garcia will start for the Orioles. He replaces Miguel Gonzalez, who has been pushed back until at least Saturday because of a blister on his right thumb. ... Baltimore has won 108 games in a row when leading after seven innings.