SAN DIEGO (AP) -- Homer Bailey gave the struggling Cincinnati Reds exactly what they needed.
The right-hander came within two outs of a five-hit shutout to end his four-start losing streak and the Reds beat the San Diego Padres 4-1 Wednesday to snap a five-game skid.
Brandon Phillips homered and Joey Votto hit a two-run double for the Reds, who avoided a three-game sweep and ended San Diego's four-game winning streak.
''Before the game I said the law of averages were on our side to win on the road, and for Homer to win,'' manager Dusty Baker said. ''It's been a long time since he's won. There were some big hits that we got today that we have been missing the past few days.
''It's great to have a great flight home, have a great day off and sort of take it easy and lick our wounds, so to speak, and get back at it again,'' Baker said.
The performance by Bailey was just what the Reds needed to end a 10-game West Coast trip on a positive note. Not only had the Reds lost five straight after winning the first four games of the trip, but Bailey hadn't won since throwing the second no-hitter of his career July 2 at home against San Francisco. Three of his four losses since then had come on the road.
Bailey had allowed just five singles going into the ninth, when Everth Cabrera reached on a fielding error by first baseman Votto leading off the inning. He got Chris Denorfia to fly out before Chase Headley doubled in Cabrera. Baker pulled Bailey, and Aroldis Chapman got the final two outs for his 25th save in 29 chances.
''It's good to get a win,'' Bailey said. ''We didn't want to come in here and get swept. We've been playing and pitching really well; just trying to go out there and end this trip on a good note.''
Bailey said he felt fine going into the ninth.
''I cooled down a little bit when they changed pitchers. I definitely wished I could have finished that one,'' Bailey said. ''But you got a pretty good closer coming in behind me.''
Bailey (6-10) allowed six hits and one unearned run, struck out seven and walked none.
Baker said Bailey had good command and ''a good tempo that helps our team stay sharp behind him. Sheer determination. Homer really, really wanted it bad because he knew we needed it and he needed it. That was big for us.''
Manager Bud Black said the Padres ''just couldn't seem to square the fastball up'' against Bailey. ''He had good movement, pitched well. He's got that capability. He's got a good arm.''
''He always has good velocity but I thought his fastball today had even a little bit more life than it usually does,'' Headley said. ''The pitches you felt like you got to hit, a lot of times you were fouling off because it had such good life, and then he threw his good stuff at you. He made a pitch or threw a good slider on you and you were in trouble. He's one of those guys when he's able to locate his pitches and throw pretty much everything he has for strikes, it's going to be a tough day. There are some times when you've got to tip your cap and he was pretty good tonight.''
Phillips homered to center field off lefty Eric Stults (8-10) leading off the second, his 13th.
The Reds added three more runs in the seventh, all unearned because of third baseman Headley's throwing error on Derrick Robinson's grounder. The error put runners on first and third, and Chris Heisey singled to left to score Zack Cosart, aboard on a leadoff single. Votto followed with a double to right to bring in Robinson and Heisey.
The Reds are off Thursday before opening an eight-game homestand.
''This off day is going to be really big for us,'' Bailey said. ''Especially after a long trip, different time zones. We started off really well. We just couldn't quite seem to squeeze out those wins in L.A., and even here, for a couple of days. It feels good to end it on a good note. You always like traveling after a win.''
Stults allowed four runs, one earned, on 10 hits in 6 2-3 innings. He struck out five and walked none.
NOTES: On Friday, the Reds play the first of three games against the NL Central rival St. Louis Cardinals. RHP Bronson Arroyo (9-8, 3.26 ERA) is scheduled to start against RHP Shelby Miller (10-7, 2.79). ... The Padres are off Thursday before welcoming the New York Yankees to Petco Park for the first time. Scheduled starters are LHP CC Sabathia (9-9, 4.65) against RHP Andrew Cashner (7-5, 3.88)....Sunday's Padres starter will be RHP Ian Kennedy, acquired from the Arizona Diamondbacks before Wednesday's deadline for lefty reliever Joe Thatcher, a minor leaguer and a 2014 draft pick.