MIAMI — For one afternoon, finally, the Dodgers were better than last place.

Justin Turner tied a career high with five RBI and Kenta Maeda pitched eight innings Thursday to help Los Angeles beat the Miami Marlins 7-0 and end a streak of six consecutive losses, all against last-place teams.

The defending National League champions climbed out of the cellar in the NL West. Rap music blared in the postgame clubhouse, a contrast to the somber atmosphere of late.

“I thought the radio in the clubhouse was out the last six days,” Manager Dave Roberts joked. “But we fixed it. So we have music. The worm has turned.”

Turner, who broke his left wrist in spring training and made his season debut Tuesday, hit a three-run double for the Dodgers’ first hit in the third inning. He added a two-run double in the fourth and also singled to finish 6 for 13 in the series (.462).

“We had felt like we were close to breaking out and having a good day,” Turner said. “Hopefully this can stick and we can put together a run.”

Maeda (3-3) allowed two hits and no walks in his longest outing of the season. He said he took the mound mindful of the losing streak.

“But obviously we’re a really good team,” he said through a translator. “I’m not worried about that.”

Maeda retired the final 17 batters he faced while throwing 96 pitches.

“He was mixing pitches well,” Miguel Rojas of Miami said. “He was working quick, throwing a lot of sliders, and we couldn’t figure it out.”

Kenley Jansen gave up two hits in the ninth but struck out three to complete the Dodgers’ sixth shutout of the year. Roberts said he thought about letting Maeda pitch the ninth but wanted to give Jansen work.

Matt Kemp had two doubles and a single for the Dodgers to hike his average to .318. Yasiel Puig hit his third home run of the season, all in the past four games.

Kemp said Turner was contagious.

“We got one of our best hitters back and he had a big day, and I think that kind of relaxed everybody,” Kemp said. “To see him battle, it’s kind of a domino effect.”

PIRATES 5, PADRES 4: Gregory Polanco led off the seventh inning with a double and scored the go-ahead run on an error, leading Pittsburgh at home to its eighth win in nine games.

Polanco took third on Francisco Cervelli’s deep fly ball, then came home when rookie third baseman Christian Villanueva misplayed Corey Dickerson’s two-out grounder.

Josh Bell and Sean Rodriguez each had two hits for the NL Central-leading Pirates.

Eric Hosmer drove in three runs for San Diego.

Freddy Galvis had two hits before being ejected by plate umpire Will Little after taking a called third strike from Michael Feliz to end the eighth inning.

AMERICAN LEAGUE

ATHLETICS 10, BLUE JAYS 5: Matt Olson hit a three-run homer, Khris Davis and Matt Chapman added two-run shots, and Oakland won at Toronto.

Davis went 4 for 4 and scored three times as Oakland won for the second time in its past 13 games north of the border.

Davis singled in the first, homered in the third, singled and scored in the fifth, came around to score after being hit by a pitch in the sixth, and singled in the eighth.

The Blue Jays lost for the ninth time in 12 home games. Toronto is 8-14 following a 14-8 start.