DENVER -- It was by no means easy, but the Colorado Rockies ended their eight-game losing streak Saturday when Brandon Barnes tripled home the winning run in the 10th inning to give the Rockies a 5-4 victory over the Los Angeles Dodgers.

Barnes entered the game in on a double-switch in the ninth, and the right fielder's two-out hit banged off the wall in right-center and scored first baseman Justin Morneau, who had singled with one out off Chris Perez (0-3.

"I know he's a sinkerball, slider guy," Barnes said after his second career walk-off hit and first with the Rockies. "He's got a really good slider, likes to throw it.

"My goal was to hit the slider, see it and put a good swing on it.

I didn't think I got it as good as I did, but I stayed through it enough to get it out there."

The Rockies blew a three-run lead in the seventh when Tim Federowicz put the Dodgers ahead, 4-3, with a three-run home run on the first pitch by Nick Masset.

Masset relieved starter Jhoulys Chacin, who remains winless after seven starts.

The winning pitcher was Franklin Morales (4-4), who pitched 1 1/3 innings. He retired four of the five batters he faced, allowing only a two-out single in the 10th to Justin Turner, and throwing 14 of his 18 pitches for strikes.

"I made my pitches, got the balls where it was supposed to go and got the hitters out," Morales said. "We had a bad stretch, lost eight in a row, and however it happened, we'll take this."

The Dodgers lost Yasiel Puig and Dee Gordon, their two best players this season, to hip injuries, Gordon leaving in the fourth because of right hip discomfort and Puig in the fifth with a right hip flexor strain.

Neither player expects to miss more than a day or two, which is the hope of manager Don Mattingly, who was optimistic because no further tests are scheduled for either player.

Gordon said he woke up with soreness in his right hip and had it stretched out by member of the training staff before the game.

"It felt a little bit better, but it wasn't to where I could be my regular self," Gordon said. "I couldn't run the way I wanted to."

Speaking through a translator, Puig said he felt something in his right leg while trying to break up a double play after drawing a walk in the fourth.

"At this point, I think it's going to be one or two days," Puig said. "Obviously, I'm going to get treatment. I'm going to put some ice on it. My hope is to be able to play. We'll see how I feel tomorrow.

"And hopefully, I'll be able to play, if not tomorrow than in Cincinnati (where the Dodgers open a four-game series Monday)."

An unearned run with two out in the seventh off starter Zack Greinke enabled the Rockies (29-32) to tie the game after Federowicz had put the Dodgers (32-31) ahead with his first home run in 64 at-bats, since Sept. 18, 2013, at Arizona.

Center fielder Drew Stubbs chopped an infield hit to third base that Justin Turner caught barehanded but then threw wildly past first. Stubbs took second on the error and scored on left fielder Corey Dickerson's single.

Matt Kemp led off the Dodger eighth with a triple off Rex Brothers. But Brothers retired Andre Ethier on a grounder, and Adam Ottavino got Turner and Federowicz to ground out.

"Probably the big inning was there in the eighth," Mattingly said. "We get our chance when Matt leads off with that triple. That's where you'd like to put a run on the board and basically get to (Brian Wilson) and hopefully (closer) Kenley (Jansen) the last two innings."

NOTES: RHP Christian Bergman will make his major league debut Monday and start for the Rockies, taking the turn of injured RHP Jordan Lyles. ... Rockies C Wilin Rosario was scratched from the lineup because of illness. ... Dodgers assistant hitting coach John Valentin was hit near the left eye with a ball that ricocheted in the indoor batting cage. The initial exam at a hospital revealed no damage to the eye and his vision was good. Valentin was scheduled to undergo a CT scan. ... Dodgers RHP Chad Billingsley, who underwent Tommy John surgery on April 24, 2013, is scheduled to start his rehab assignment for the second time Sunday and throw about 30 pitches for High Class-A Rancho Cucamonga. ... Rockies RF Michael Cuddyer, who suffered a left shoulder strain Thursday, did not play for the second straight day.